MathGroup Archive 1999

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

Search the Archive

Re: Function definition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15796] Re: Function definition
  • From: "Martin Rommel" <rommel at semitest.com>
  • Date: Sun, 7 Feb 1999 02:04:12 -0500 (EST)
  • Organization: EarthLink Network, Inc.
  • References: <79ea4l$9hm@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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


RTFM: 2.5.8


theta0=Pi/2;phi0=Pi;

f[theta_,phi_]:=f1 /;
(0<=theta)&&(theta<=theta0)&&(0<=phi)&&(phi<=phi0);

f[theta_,phi_]:=f2;

Again: More elegant solutions are appreciated!

>I have tried using Do loops and If statements but haven't been
>successful.


Martin



  • Prev by Date: Re: Q: how to list vertices of the Geodesate[] of a polyhedron?
  • Next by Date: Re: How to use DisplayTogether[] properly?
  • Previous by thread: Re: Function definition
  • Next by thread: Re: Function definition