Re: Function definition

*To*: mathgroup at smc.vnet.net*Subject*: [mg15774] Re: [mg15737] Function definition*From*: Carl Woll <carlw at fermi.phys.washington.edu>*Date*: Sun, 7 Feb 1999 02:03:53 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Hi, Why don't you use patterns? f[theta_ /; 0<=theta<=theta0, phi_ /; 0<=phi<=phi0] := f1[theta,phi] f[theta_, phi_] := f2[theta,phi] Carl Woll Dept of Physics U of Washington On Fri, 5 Feb 1999, Rangachari Kidambi wrote: > > Hi, > > I need to define a function f(theta,phi) as > > f(theta,phi) = f1 if 0 <= theta <= theta0, 0 <= phi <= phi0 f(theta,phi) > = f2 otherwise > > where theta, phi are spherical polar coordinates, <= is less than or > equal to and theta0 and phi0 are constants. > > I have tried using Do loops and If statements but haven't been > successful. > > Thanks for any help > Ranga Kidambi > >