Re: Variable functions
- To: mathgroup at smc.vnet.net
- Subject: [mg36206] Re: [mg36180] Variable functions
- From: BobHanlon at aol.com
- Date: Tue, 27 Aug 2002 02:07:13 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 8/26/02 5:24:29 AM, rajgupta121 at rediffmail.com writes: > I am a newbie to mathematica. I have a 14 functions which are the > function of r,theta and phi. I want to do some mathematical operation > over them. How can I do? Can it be possible to call them in Do or For > loop with some index? > As a general rule avoid Do and For loops and just operate on Lists or Map (/@) onto lists. g /@ {f1[r,theta,phi], f2[r,theta,phi], f3[r,theta,phi]} {g[f1[r, theta, phi]], g[f2[r, theta, phi]], g[f3[r, theta, phi]]} This can be written more compactly as g /@ (#[r,theta,phi]& /@ {f1,f2,f3}) {g[f1[r, theta, phi]], g[f2[r, theta, phi]], g[f3[r, theta, phi]]} Bob Hanlon Chantilly, VA USA