Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Re: Derivatives of user-defined control-flow functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51132] Re: [mg51096] Re: Derivatives of user-defined control-flow functions
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Tue, 5 Oct 2004 04:37:36 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 4 Oct 2004, at 19:18, Maxim wrote:
>  Notice that while
> Mathematica's rule for the differentiation of If can be handy, it is,
> strictly speaking, not correct; for example:
>
> In[9]:=
> D[If[x == 0, 0, Sin[x]^2/x], x]
>
> Out[9]=
> If[x == 0, 0, (2*Sin[x]*Cos[x])/x - Sin[x]^2/x^2]
>
> while the correct value for the derivative at zero is 1.
>
> Maxim Rytin
> m.r at inbox.ru
>
>
One may also argue that you defined this function incorectly, at least 
if you were intending to differentiate it at 0.
Since:


Normal[Sin[x]^2/x + O[x]^2]

x

the "correct" definition should be

If[x == 0, x, Sin[x]^2/x]

in which case differentiation will give the right answer.



Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/~andrzej/
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: Re: Special case of plotting a 3D function
  • Next by Date: Re: Re: suggestion for frontend
  • Previous by thread: Re: Derivatives of user-defined control-flow functions
  • Next by thread: Re: Thichness of Plot does not change Solved