Re: Defining function
- To: mathgroup at smc.vnet.net
- Subject: [mg44561] Re: [mg44539] Defining function
- From: Yasvir Tesiram <yat at omrf.ouhsc.edu>
- Date: Fri, 14 Nov 2003 01:58:57 -0500 (EST)
- Organization: OMRF
- References: <200311131236.HAA23886@smc.vnet.net>
- Reply-to: yat at omrf.ouhsc.edu
- Sender: owner-wri-mathgroup at wolfram.com
Here are a couple of ideas, f[x_] := If[x > 0, Exp[-x], If[x == 0, Print["Don't know what to do at zero"], 0]] g[x_] := Switch[x, _Integer && x > 0, Exp[-x], _Integer && x == 0, Print["Don't know what to do at zero"], _Integer && x < 0, 0 ] You may also like to try out Condition and Which. Cheers Yas Ravinder Kumar B. wrote: > 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. > Regards, > Ravi >
- References:
- Defining function
- From: "Ravinder Kumar B." <ravi@crest.ernet.in>
- Defining function