Symbolic Derivative of Piecewise Contin Fcn
- To: mathgroup at smc.vnet.net
- Subject: [mg15490] Symbolic Derivative of Piecewise Contin Fcn
- From: sullivan at indra.com (Steve Sullivan)
- Date: Mon, 18 Jan 1999 04:22:33 -0500
- Sender: owner-wri-mathgroup at wolfram.com
How can I get a symbolic derivative on a region of a piecewise
continuous function using Mathematica? Two simple examples, extracted
from long Modules are below.
Alternatively, is there some magic functional M that, given a piecewise
contin function, would return a piece of it? For example, let: f[x_]
:= If[ x < 0, x^2, x^5] Is there a M such that: M[ f, {x < 0}] would
return: x^2
Many thanks for any help ...
Steve
The following examples of the failure of D[] are extracted from much
more complicated functions. They were run using Mathematica 3.0.
htest[ uval_ ] := Module [
{res},
If[ uval < 0, res = uval^2, res = uval^5];
res
]
D[ htest[ uval], uval]
==> returns: 0
tstb[ pow_Integer, uval_ ] := Module [
{res}, (* local vars *)
If[ pow == 0,
If[ uval < 0, res = 0, res = uval^2],
res = uval^5 * tstb[ pow-1, uval]
];
res (* return *)
]
D[ tstb[ 0, uval], uval]
==> returns: 0
D[ tstb[ 1, uval], uval]
==> returns: 5 res$4 uval^4 (?? what is res$4 ?)