Re: Defining function
- To: mathgroup at smc.vnet.net
- Subject: [mg44556] Re: Defining function
- From: "Curt Fischer" <crf3 at po.cwru.edu>
- Date: Fri, 14 Nov 2003 01:58:49 -0500 (EST)
- References: <bovtvd$nbc$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Ravinder Kumar B." <ravi at crest.ernet.in> wrote in message news:bovtvd$nbc$1 at smc.vnet.net... > Dear All, > 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 > > Your response/clarification will be deeply appreciated. One possibility is to use If[], but you will probably be better off if you use UnitStep[]: In[1]:= f[t_] := UnitStep[t] Exp[-I t] In[2]:= Plot[Re[f[t]], {t, 0, 10}, PlotRange -> {{-2 Pi, 2 Pi}, {-1, 1}}] Doing calculus with Integrate[] and the like works much, much better if you use UnitStep. -- Curt Fischer