Re: piecewise definition of a function
- To: mathgroup at smc.vnet.net
- Subject: [mg43905] Re: piecewise definition of a function
- From: Bill Rowe <readnewscix at mail.earthlink.net>
- Date: Fri, 10 Oct 2003 03:06:31 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 10/9/03 at 1:55 AM, nmoore at physics.umn.edu (Nathan Moore) wrote:
> I'd like to define a function in a piecewise manner. As of yet I've
> been unsuccessful with even the simplest example. Consider the
> following:
> first define a 1-d bump,
> f[x_] = If[x < 0, 0,If[x > 1, 0, 1]]
> Mathematica doesn't seem to mind this, as f[0.1] evaluates 1 and
> f[-23] evaluates 0.
> The problem comes when I try to integrate the function. The
> following command which should evaluate to 1 doesn't work AT ALL!
Try defining piecewise functions using UnitStep, i.e.
f[x_]:= UnitStep@x - UnitStep[x-1]
Integrate[f[x], {x, -10, 10}]
--
To reply via email subtract one hundred and nine