Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Problems with differentiating Piecewise functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86953] Re: Problems with differentiating Piecewise functions
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 27 Mar 2008 08:17:28 -0500 (EST)

On 3/26/08 at 4:55 AM, howard.lovatt at gmail.com (hlovatt) wrote:

>If I set up a piecewise function and differentiate it:

>In[112]:= pw1 = Piecewise[{{x^2, x <= 0}, {x, x > 0}}]

>Out[112]= \[Piecewise] {
>{x^2, x <= 0},
>{x, x > 0}
>}

>In[113]:= pw1 /. x -> 0

>Out[113]= 0

>In[114]:= pw1d = D[pw1, x]

>Out[114]= \[Piecewise] {
>{2 x, x < 0},
>{1, x > 0},
>{Indeterminate, \!\(\*
>TagBox["True",
>"PiecewiseDefault",
>AutoDelete->False,
>DeletionWarning->True]\)}
>}
>
>In[115]:= pw1d /. x -> 0

>Out[115]= Indeterminate

>Then at the joins between the pieces I get Indeterminate values,
>because the limit x <= 0 has become x < 0 after differentiation. Does
>anyone know a solution to this problem?

You haven't made it clear what you are trying to do. Clearly,
the first derivative of your function is undefined at x = 0 as
Mathematica is indicating. Since this is mathematically correct,
there is little that can be done short of defining a different
function if you want a continuous first derivative.


  • Prev by Date: Re: Series and Sqrt problem (a bug?)
  • Next by Date: Re: Color Options for PlanarGraphPlot
  • Previous by thread: Re: Problems with differentiating Piecewise functions
  • Next by thread: Re: Problems with differentiating Piecewise functions