# [Maxima] diff -- second argument

Stavros Macrakis macrakis at alum.mit.edu
Thu Feb 16 13:12:48 CST 2012

```Actually, a little reflection makes it clear that diff(f(x),g(x)) should
not be an error or a noun form, because in fact it is perfectly
well-defined and meaningful:

diff(A,B) == ev(diff(A)/diff(B),del)

For example,

diff(sin(x),x) == cos(x)*del(x)/del(x) == cos(x)
<< diff(...,V) reduces to normal differentiation
diff(sin(x),cos(x)) == cos(x)*del(x)/(-sin(x)*del(x)) ==
-cos(x)/sin(x)
<< in diff(f(x),g(x)), del(x)/del(x) => 1
diff(x*y,x^2+y^2) == (x*del(y)+y*del(x)) / (2*y*del(y) + 2*x*del(x))
<< consistent handling of multiple-variable case

How useful is this?  I'll leave that to others....

Right now, Maxima doesn't do much of interest with del(...) -- not even
giving an error for del(1) -- but it does do ev(del(x^2),del) == diff(x^2)
== 2*x*del(x).  You can even try ratsubst('diff(x,y),del(x)/del(y),...) on
del expressions and get things that look reasonable (and useful?)....

One problem: diff(del(x)) => 'diff(del(x),x)*del(x), which is I suppose
correct, but ugly and hard to work with.  Can be deferred for now.

Any objections to this definition of diff with a second argument which is
an expression?

-s

On Thu, Feb 16, 2012 at 11:42, Raymond Toy <toy.raymond at gmail.com> wrote:

>
>
> On Wed, Feb 15, 2012 at 11:28 PM, Robert Dodier <robert.dodier at gmail.com>wrote:
>
>> On 2/15/12, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>>
>> >           diff(x,tan(x)) => 0
>> >           diff(x,f(x)) => 0
>> >
>> > but not
>> >
>> >            diff(x,1+x) => error
>> >
>> > In principle, all of these could of course be meaningful, but Maxima
>> > doesn't know that.
>> >
>> > Which seems more useful for users in such cases?:
>> >
>> > * Giving an error?
>> > * Leaving as noun forms? (which Maxima can't do anything useful with)
>>
>> Well, in general it seems useful, and consistent with Maxima's
>> behavior in other cases, to return a noun form. Then sufficiently
>> clever people (whether it's the developers or anybody else) can
>> impose an interpretation of such expressions via the simplification
>> system.
>>
>
> Returning a noun form does seem to be Maxima's standard behavior, but I
> often find it rather annoying.  Say I do an integral and I get a noun form
> back.  Not because maxima can't really do the integral but because some
> function deep in the bowels of the integration routines failed.  Rather
> than giving some indication of that, maxima silently returns a noun form.
>
> Noun forms are nice for users, but sometimes painful for developers.
>
> I don't know what the right balance should be.
>
> Ray
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120216/1dda8b94/attachment.html>
```