       Re: Working with D, definition of a function

• To: mathgroup at smc.vnet.net
• Subject: [mg75979] Re: Working with D, definition of a function
• From: Bill Rowe <readnewsciv at sbcglobal.net>
• Date: Mon, 14 May 2007 03:45:02 -0400 (EDT)

```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:= ComPathPrime[w, 1]

Out= 2*I*(I*w + 1)

Which is the same as

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

Out= 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:= D[ComPath[w, mu, 0], w]

Out= 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