MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Working with D, definition of a function


On 5/13/07 at 5:46 AM, thomas.??? at balliol.ox.ac.uk (Thomas Schmelzer)
wrote:

>I have defined a map

>ComPath[w_, mu_, bias_] := mu*(\[ImaginaryI]*w + 1)^2 + bias; Now, I
>would like to use the derivative with respect to w as a further
>function.

>D[ComPath[w, mu, 0], w]

>gives the answer I expect, but

>ComPathPrime[w_, mu_] := D[ComPath[w, mu, 0], w];

>doesn't seem to make sense

>ComPathPrime[2, 1]

>results in

>General::ivar : 2 is  not a valid variable.

Right.

Notice what you've asked Mathematica to do. That is you are
asking Mathematica to compute the derivative of -3 + 4 I (the
result returned by ComPath[2,1,0] with respect to 2 (the value
you gave w). So, it should be no surprise when Mathematica complains

Notice

In[16]:= ComPathPrime[w, 1]

Out[16]= 2*I*(I*w + 1)

Which is the same as

In[14]:= D[ComPath[w, mu, 0], w]

Out[14]= 2*I*mu*(I*w + 1)

So, it is clear ComPathPrime is working correctly

If you need ComPathPrime evaluated at a specific value for w
then do

In[14]:= D[ComPath[w, mu, 0], w]

Out[14]= 2*I*mu*(I*w + 1)
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Problem with reading version 4.2 DumpSave files,...
  • Next by Date: Re: Re: Shadows in Mathematica 6
  • Previous by thread: Re: Working with D, definition of a function
  • Next by thread: A fun little problem