Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Function definition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15763] Re: Function definition
  • From: "Stephen P Luttrell" <luttrell at signal.dra.hmg.gb>
  • Date: Sun, 7 Feb 1999 02:03:46 -0500 (EST)
  • Organization: Defence Evaluation and Research Agency
  • 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.


Assuming that all the variables have numerical values, this function
definition should do what you want:

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

The first line applies only when the condition 0<=theta<=theta0 &&
0<=phi<=phi0 holds, and the second line applies otherwise.

Stephen P Luttrell
Signal Processing and Imagery Department DERA Malvern, St.Andrew's Road
Malvern, United Kingdom, WR14 3PS

+44 (0)1684 894046 (tel)
+44 (0)1684 894384 (fax)
luttrell at signal.dera.gov.uk (email)




  • Prev by Date: Re: BracketingBar for output
  • Next by Date: log plots
  • Previous by thread: Re: Function definition
  • Next by thread: Re: Function definition