MathGroup Archive 2004

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

Search the Archive

Re: UnitStep


(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


  • Prev by Date: Re: Heko with datanase connections in Mathematica 5.1
  • Next by Date: Re: Iterator problem.
  • Previous by thread: Re: UnitStep
  • Next by thread: Re: UnitStep