MathGroup Archive 1999

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

Search the Archive

Re: Differentiation wrt functions in Mathematica

  • To: mathgroup at
  • Subject: [mg20385] Re: [mg20327] Differentiation wrt functions in Mathematica
  • From: Daniel Lichtblau <danl at>
  • Date: Mon, 18 Oct 1999 02:40:31 -0400
  • References: <>
  • Sender: owner-wri-mathgroup at

jonparker at wrote:
> I am trying to get Mathematica 3.0 to differentiate equations
> containing Sin and Cos terms, with respect to Sin[x] and Cos[x].  On
> investigation of the results I find I am not getting the answer I
> expect.  As a test I asked M to evaluate the following:
> D[Sin[x],{Cos[x],1}]
> and go the result 0.  I would have expected to get -Cos[x]/Sin[x].  If
> I reformulate the expression as:
> D[(1-Cos[x]^2)^.5,{Cos[x],1}]
> I then get the answer I expect.  This work-around is not convenient for
> the full expressions I would like to deal with.
> Is there a way of reminding M the Sin=(1-Cos^2)^.5?
> Thanks, Jon
> Sent via
> Before you buy.

Here are some possibilities.

(i) Transform coordinates explicitly.

In[25]:= InputForm[D[Sin[ArcCos[u]], u] /. u->Cos[x]]
Out[25]//InputForm= -(Cos[x]/Sqrt[1 - Cos[x]^2])

This may be simplified a bit using Simplify, and then one might invoke
PowerExpand to kill any branch cut distinctions.

In[26]:= PowerExpand[Simplify[%25]]
Out[26]= -Cot[x]

(ii) Use the chain rule to define your own differentiation with respect
to a function. Since df/du = (df/dx) * (dx/du) = (df/dx) / (du/dx) this
may be done rather simply as below.

In[27]:= functionalD[f_, g_, x_] := D[f,x] / D[g,x]   

In[28]:= functionalD[Sin[x], Cos[x], x]
Out[28]= -Cot[x]

Daniel Lichtblau
Wolfram Research

  • Prev by Date: Help: Win32 Graphics output
  • Next by Date: Re: Font problems running remotely
  • Previous by thread: Differentiation wrt functions in Mathematica
  • Next by thread: Re: Differentiation wrt functions in Mathematica