Re: Re: Backwards?
- To: mathgroup at smc.vnet.net
- Subject: [mg3531] Re: [mg3496] Re: Backwards?
- From: wagner at bullwinkle.cs.Colorado.EDU (Dave Wagner)
- Date: Thu, 21 Mar 1996 01:08:08 -0500
- Organization: University of Colorado, Boulder
- Sender: owner-wri-mathgroup at wolfram.com
In article <4ibbb7$fep at ralph.vnet.net>, Artur KUO <artur at galilei.pi.tu-berlin.de> wrote: >I would like to ask a question please. >How can I let Mathematica do this: > >1) c[x,y]*a[x]*D[b[x],x]+c[x,y]*b[x]*D[a[x],x]+d[x,y] > --->c[x,y]*D[a[x]*b[x],x]+d[x,y] ? > It's backward-chainrule. This exact question came up in a Mathematica workshop that I taught recently. What you want to do is back-substitution. Unfortunately, rule substitution using "/." is completely syntactic, not algebraic. (But see AlgebraicRules in the Mma book). You can get around this problem by a tricky use of Solve. Here's a simple example: (Local2) In[1]:= g[x_] := 1/(1+Exp[x]) (Local2) In[2]:= g'[x] (Local2) Out[2]= x E -(---------) x 2 (1 + E ) We'd like to rewrite this expression in terms of g[x]. Here's how to do it: (Local2) In[3]:= Solve[{dummy==%, gx == g[x]}, dummy, x] (Local2) Out[3]= {{dummy -> (-1 + gx) gx}} The second argument to Solve gives the name of the variable(s) to solve for, and the little-used third argument gives the names of the variable(s) to attempt to eliminate. With a bit of fooling around you can probably apply this technique to your own problem >2) If I let u^2+v^2:=1, how cann I do: > > a*u^2+a*v^2==a*1==a ? (Local2) In[4]:= Solve[{dummy==a*u^2 + a*v^2, u^2+v^2==1}, dummy] (Local2) Out[4]= {{dummy -> a}} Dave Wagner Principia Consulting (303) 786-8371 dbwagner at princon.com http://www.princon.com/princon ==== [MESSAGE SEPARATOR] ====