       do we need to be moderated? Re: Piecewise Functions

• To: mathgroup at smc.vnet.net
• Subject: [mg4633] do we need to be moderated? Re: Piecewise Functions
• From: george at mech.seas.upenn.edu ( George Jefferson )
• Date: Thu, 22 Aug 1996 03:54:51 -0400
• Organization: Mechanical Engineering
• Sender: owner-wri-mathgroup at wolfram.com

```This this question was asked so long ago that its expired and I cant
even remember what the question was.  No offense, I'm sure moderating
its alot of work, but if you are going on vacation or something
cant you temporatily let everything pass through?

:> i'm stumped...
:
:You can approximate the derivative numerically by using a function such as:
:
:fderiv[x_]:=(f[x]-f[x-0.001] )/0.001
:
:It might not be elegant, but it works.

as I recall, the problem is that for a pievewise function:

f[x_ /; x> 0] := g[x]
f[x_ /; x<=0] := h[x]

differentiation doesn't work correctly even where we specify
the point x:

D[f[x],x] /. x-> -1

f'[-1]

the best I could come up with is to define the derivates piecewise
as well:

f'[x_ /; x>0 ] := D[g[y],y] /. y->x
f'[x_ /; x<0 ] := D[h[y],y] /. y->x

D[f[x],x] /. x-> 1

g'

This doesn't look too bad for this simple example but its
still a real mess where you have multiple derivateves and
more complicated functions..

==== [MESSAGE SEPARATOR] ====

```

• Prev by Date: Re: Newby: filing graphics in MMA-WIN
• Next by Date: Re: List of x,y pairs to use with ListPlot
• Previous by thread: new Package: Transform2DPlot.m
• Next by thread: Re: do we need to be moderated? Re: Piecewise Functions