Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica derivative

  1. Sep 17, 2010 #1
    Mathematica:

    Code (Text):
    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.
     
  2. jcsd
  3. Sep 17, 2010 #2
    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.
     
  4. Sep 17, 2010 #3
    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.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook