Re: UnitStep
- To: mathgroup at smc.vnet.net
- Subject: [mg52334] Re: [mg52326] UnitStep
- From: DrBob <drbob at bigfoot.com>
- Date: Wed, 24 Nov 2004 02:32:05 -0500 (EST)
- References: <200411230712.CAA29371@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
(1/0)*0 is undefined in Mathematica, just as it should be.
You can define the function this way, however:
(inputs)
f[p_] = If[p == 0, 0, (1/p) UnitStep[p - 1]];
Integrate[f@x, {x, -5, 5}]
D[f@x, {x}]
Integrate[%, x]
Plot[f@x, {x, -5, 5}]
(outputs)
Log[5]
If[x == 0, 0, DiracDelta[x - 1]/
x - UnitStep[x - 1]/x^2]
Integrate[If[x == 0, 0,
DiracDelta[x - 1]/x -
UnitStep[x - 1]/x^2], x]
(and a plot)
D followed by Integrate is unevaluated.
In version 5.1 we have a different choice:
(inputs)
f[p_] = Piecewise[{{0, p == 0}, {(1/p) UnitStep[p - 1], True}}];
Integrate[f@x, {x, -5, 5}]
D[f@x, {x}]
Integrate[%, x]
Plot[f@x, {x, -5, 5}]
(outputs)
Log[5]
Piecewise[{{0, x < 1}, {-(1/x^2), x > 1}}, Indeterminate]
Piecewise[{{0, x <= 1}}, -1 + 1/x]
(and a plot)
This time D followed by Integrate is evaluated, but WRONG.
Bobby
On Tue, 23 Nov 2004 02:12:45 -0500 (EST), Blimbaum, Jerry AA R22 <jerry.blimbaum at navy.mil> wrote:
> Why does the following give me 'indeterminate, infinite expression
> encountered', etc. instead of zero....
>
>
> (1/p) UnitStep[p-1] /.p->0
>
>
> I defined a function using the UnitStep because p could = 0 and I
> thought this would be the way around that problem.......but didnt work
> the way I expected.....
>
>
> jerry blimbaum
>
>
>
>
>
--
DrBob at bigfoot.com
www.eclecticdreams.net
- References:
- UnitStep
- From: "Blimbaum, Jerry AA R22" <jerry.blimbaum@navy.mil>
- UnitStep