Re: piecewise definition of a function
- To: mathgroup at smc.vnet.net
- Subject: [mg43876] Re: piecewise definition of a function
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 10 Oct 2003 03:05:45 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <bm2ub8$6s1$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
Integrate[UnitStep[x] - UnitStep[x - 1], {x, -1, 1}]
Regards
Jens
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!
>
> Integrate[f[x], {x, -50, 50}]
>
> What is the proper technique here?
>
> Nathan Moore
> University of Minnesota Physics