How can I build a unspecified mapping




On Mon, 5 Oct 2009, Richard Fateman wrote:

< jie liu wrote:
< > I have an expression H(q), containing a time-varying variable q(t), I
< > want to obtain the time derivative of the expression, in which the
< > result will contain 'dq'the derivative of q(t), how can I realize it?
< >
< > I knew how to do this in Maple. You just establish a mapping of
< > q:=q->(t), you differentiate the expression, and obtain the expression
< > dH(q,dq/dt) , then substitute dq/dt with a new variable dq.  but
< > Maxima does not provide such function, how can I do it?
< >
< >   
< It's not entirely clear to me what you want, but you can do this:
< 
< gradef(q(t),dqdt);
< 
< diff(q(t)^2,t);
< 
< you get 2*q(t)*dqdt.
 
Possibly you are looking for something like this

(%i3) depends(H,[q]);
(%o3)                               [H(q)]
(%i4) diff(H);
                                   dH
(%o4)                              -- del(q)
                                   dq
(%i5) subst(del(q)=v,%);
                                       dH
(%o5)                                v --
                                       dq

Note that Maxima computes dH in %o4, without recourse to introducing
some artificial dependence. Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.