Re: piecewise definition of a function
- To: mathgroup at smc.vnet.net
- Subject: [mg43901] Re: [mg43870] piecewise definition of a function
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Fri, 10 Oct 2003 03:06:24 -0400 (EDT)
- References: <200310090555.BAA06768@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I guess that in this particular case you'd do better using UnitStep (q.v.).
Plot this to check that this is indeed the function you wish to integrate:
In[1]:=
f[x_] := UnitStep[x*(1 - x)]
In[2]:=
Integrate[f[x], {x, -50, 50}]
Out[2]=
1
Tomas Garza
Mexico City
----- Original Message -----
From: "Nathan Moore" <nmoore at physics.umn.edu>
To: mathgroup at smc.vnet.net
Subject: [mg43901] [mg43870] piecewise definition of a function
> 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
>
>
- References:
- piecewise definition of a function
- From: Nathan Moore <nmoore@physics.umn.edu>
- piecewise definition of a function