MathGroup Archive 2001

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

Search the Archive

Re: Integration of "Which" function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32109] Re: [mg32100] Integration of "Which" function
  • From: BobHanlon at aol.com
  • Date: Thu, 27 Dec 2001 03:34:10 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 12/25/01 12:04:20 AM, klepachd at yahoo.com writes:

>I am trying to integrate :
>Integrate[Which[0 <= x <= 1/2, 0, 1/2 < x <= 1, 2], {x, 0, 1}]
>

Your function is essentially the UnitStep function

Clear[f];
f[x_] := 2*UnitStep[x-1/2];

However, f gives a different value at x = 1/2

f[1/2]

2

Assuming that the value at this point matters, 
this can be fixed with a separate definition for 
x = 1/2

f[1/2] = 0;

Integrate[f[x], {x, 0, 1}]

1

Plot[{f[x], Integrate[f[t], {t, 0, x}]}, 
    {x, 0, 1}];


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: size of graphics for animation
  • Next by Date: RE: Integration of "Which" function
  • Previous by thread: Re: Integration of "Which" function
  • Next by thread: RE: Integration of "Which" function