Re: Chain rule
- To: mathgroup at smc.vnet.net
- Subject: [mg24589] Re: [mg24562] Chain rule
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Tue, 25 Jul 2000 00:56:20 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Once you eveluate x=2t +5 in Mathematica it no longer makes sense to differentiate anything with respec to x: In[27]:= x = 2t + 1 Out[27]= 1 + 2 t In[28]:= D[f, x] General::"ivar": "1 + 2t is not a valid variable." Out[28]= D[f, 1 + 2 t] However, you can still make Mathematica "use the Chain rule" in the way you want by making use of Mathematica's ability to solve equations, and eliminate variables. Here is an example using Solve (one can also use GroebnerBasis or Reduce): In[29]:= eq1 = x - 2t - 5; eq2 = y - 2t^2 + 1; In[26]:= Solve[{eq1 == 0, eq2 == 0, Dt[eq1, x] == 0, Dt[eq2, x] == 0}, {Dt[y, x], x}, {Dt[t, x], y, t}] Solve::"svars": "Equations may not give solutions for all \"solve\" \ variables." Out[26]= {{Dt[y, x] -> -5 + x}} Note that you have to use the total differential Dt rather than the derivative D. -- Andrzej Kozlowski Toyama International University, JAPAN For Mathematica related links and resources try: <http://www.sstreams.com/Mathematica/> on 7/24/00 9:04 AM, Claude at fran_claude at hotmail.com wrote: > Hello, > > I am just trying to solve: > dy/dx when x = 2t + 5 and y = 2t^2 - 1. > > Can it be done directly by Mathematica or do I have to solve dy/dt and > dx/dt and finally divide dy/dt by dx/dt? > > I tried posing x = 2t + 5 and y = 2t^2 - 1 and ask solve for D [y,x], but > that does not evaluate properly (the answer is 2t). I would have thought > that Mathematica would have used the chain rule automatically. > > Thanks for your help, > > > >