Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

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>
  • 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