MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Function definition


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
> 
> 



  • Prev by Date: Re: List Position
  • Next by Date: Re: List Position
  • Previous by thread: Function definition
  • Next by thread: Re: Function definition