Re: Differentiating functions of vectors
- To: mathgroup at smc.vnet.net
- Subject: [mg9479] Re: [mg9424] Differentiating functions of vectors
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Thu, 6 Nov 1997 02:40:24 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Loris Bennett <loris at ferro.physik.TU-Berlin.DE> [mg9424] Differentiating functions of vectors >If I have a function such as f[ a_ , b_ ] := a . b > how do I differentitate w.r.t a certain component without having to > specify the components of the vector explicitly? I had hoped > something like fa[ a_ , b_ ] = D[ f [ a . b ] , a[[1]]] > would work, but it doesn't. Loris; Two slight changes in your code seem to do the trick in this example- but you probably have more complicated situations in mind: In[1]:= f[u_,v_]:= u.v; In[2]:= fa[ a_ , b_ ] := D[ f [ a , b ] , a[[1]]] (*:= for =, and , for .*) In[3]:= a= {x,y,z}; In[4]:= b= {p,q,r}; In[5]:= fa[ a, b ] Out[5]= p Allan Hayes hay at haystack.demon.co.uk http://www.haystack.demon.co.uk/training.html voice:+44 (0)116 2714198 fax: +44 (0)116 2718642 Leicester, UK