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)