MathGroup Archive 1998

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

Search the Archive

Re: Differentiating Piecewise Functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14825] Re: Differentiating Piecewise Functions
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Wed, 18 Nov 1998 01:29:30 -0500
  • Organization: University of Western Australia
  • References: <72e2q0$oi3@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Des Penny wrote:

> I've got a problem understanding how Mathematica finds the derivative of
> a piecewise function.
> 
> Consider the following:
> In[1]:=
> Clear[f]
> f[x_ /; (x<0)]:=x;
> f[x_ /; (x>=0 && x<3)]:=Sin[x];
> f[x_ /; (x>=3)]:=x-4;

Not an answer to your question -- but another approach to your problem
is to use FunctionInterpolation:

  g = FunctionInterpolation[f[x], {x, -5, 10}, 
    InterpolationPoints -> 30, MaxRecursion -> 8]; 

  Plot[Evaluate[{g[x], g'[x]}], {x, -5, 10}, 
   PlotStyle -> {Hue[0], Hue[1/3]}]; 

Cheers,
	Paul

____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907       
mailto:paul at physics.uwa.edu.au  AUSTRALIA                       
http://www.physics.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________


  • Prev by Date: Re: Mathematica vs MacOS 8.5
  • Next by Date: Re: looking for good introduction to Mathematica
  • Previous by thread: Re: Differentiating Piecewise Functions
  • Next by thread: Damaged Mathematic Systems Files, and Deleting Mathematica Caches?