On 03/29/2010 12:19 PM, Sheldon Newhouse wrote:
> On 03/29/2010 09:20 AM, ?????? ?????? wrote:
>
>> Hello,
>>
>> I'm currently thinking of switching from Maple to Maxima in my research work. Unfortunately, I
>> encountered the following problem. I often deal with functions in general form, e.g., u(x),
>> u(2*x), f(g(t)), etc. What I need is to obtain their derivatives:
>> diff(u(x), x) = u'(x),
>> diff(u(2*x), x) = 2*u'(2*x),
>> diff(f(g(t)), t) = f'(g(t))*g'(t)*t,
>> and so on.
>> But apparently Maxima doesn't have a proper way to display this. More specific, it doesn't have
>> operator form of differentiation. In Maple it is "D" operator: if you have a function of one
>> argument named f, then D(f) denotes its derivative, regardless of what argument you supply to
>> it. In Maxima you cannot denote the derivative of a function without explicitly specifying its
>> arguments, and that is the reason why, for example, it cannot apply chain rule to
>> differentiating f(g(t)).
>>
>> Is there any way to handle this problem? Is it possible to write a function that will act as a
>> differential operator?
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>>
>>
> I don't know what you want to do exactly, but you can play with various
> definitions in which evaluations are done or not done in different places.
>
> E.g.
>
> (%i43) display2d: false;
>
> (%o43) false
> (%i44) MyD(f,g,x):= 'diff(f(g(x)),g(x))*diff(g(x),x);
>
> (%o44) MyD(f,g,x):='diff(f(g(x)),g(x))*diff(g(x),x)
> (%i45) MyD(f,g,x);
>
> (%o45) 'diff(g(x),x,1)*'diff(f(g(x)),g(x),1)
> (%i46) g(x):= x^2;
>
> (%o46) g(x):=x^2
> (%i47) f(x);
>
> (%o47) f(x)
> (%i48) g(x);
>
> (%o48) x^2
> (%i49) MyD(f,g,x);
>
> (%o49) 2*x*'diff(f(x^2),x^2,1)
> (%i50) f(x):= cos(x)^2;
>
> (%o50) f(x):=cos(x)^2
> (%i51) MyD(f,g,x);
>
> (%o51) 2*x*'diff(cos(x^2)^2,x^2,1)
> (%i52) diff(f(g(x)),x);
>
> (%o52) -4*x*cos(x^2)*sin(x^2)
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
> .
>
>
You can also add a 'subst' to the preceding if that helps:
(%o77) MyD1(f,g,x):=subst(g(x) = u,'diff(f(g(x)),g(x))*diff(g(x),x))
(%i78) f(x);
(%o78) f(x)
(%i79) g(x);
(%o79) x^2
(%i80) MyD1(f,g,x);
(%o80) 2*'diff(f(u),u,1)*x
HTH,
-sen