Re: Defining function

*To*: mathgroup at smc.vnet.net*Subject*: [mg44558] Re: Defining function*From*: Bill Rowe <readnewscix at mail.earthlink.net>*Date*: Fri, 14 Nov 2003 01:58:52 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

On 11/13/03 at 7:36 AM, ravi at crest.ernet.in (Ravinder Kumar B.) wrote: > How to define a function over two different ranges in mathematica. > For example > > f(t):= Exp[-i*t] for t > 0 and > = 0 for t < 0 There are several possible ways to do this. Any of the following will do: f[x_]:=Exp[-I x]/;x>0 f[x_]:=0/;x<0 f[x_]:=If[x>0, Exp[-I x], 0] f[x_]:= UnitStep[x] Exp[-I x] Note, while each of these three methods will have the same plot they are not totally identical. The first leaves f[x] undefined at x = 0. -- To reply via email subtract one hundred and nine