Calculate Derivative of Function in Mathematica

  • Context: Mathematica 
  • Thread starter Thread starter Rasalhague
  • Start date Start date
  • Tags Tags
    Derivative Mathematica
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 3K views
Rasalhague
Messages
1,383
Reaction score
2
Mathematica:

Code:
In[1]:= x = {(u + 2 v)/3, (u - v)/3, w}; D[x[u], u]

Out[1]= {1/3, 1/3, 0}[u] + {(u + 2 v)/3, (u - v)/3, w}’[u]

Why does it do this? Wolfram Alpha gives the answer I expected:

http://www.wolframalpha.com/input/?i=d%2Fdu+%28{%28u+%2B+2+v%29%2F3%2C+%28u+-+v%29%2F3%2C+w}%29

{1/3, 1/3, w’(u)} = {1/3, 1/3, 0} if w doesn't change with u.
 
Physics news on Phys.org
You defined
x = { ... }
without reference to u. So x was stored as { ... }.
Then you tried taking the derivative of x, which gets converted to
{ ... }
which doesn't make sense. If you ask for D[x,u] you will get what you wanted.

Wolfram Alpha has a more flexible grammar -- ie it's not a programming language.
Thus it guessed what you meant.
 
Thanks, Simon. Problem solved. Yes, I've noticed before that WA is more forgiving and able to guess (for better or worse) at the meaning of ambigious syntax.