MathGroup Archive 2004

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

Search the Archive

RE: Long function defintions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49662] RE: [mg49654] Long function defintions
  • From: "David Park" <djmp at earthlink.net>
  • Date: Tue, 27 Jul 2004 07:00:39 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Aaron,

Something like this?

f[x_] := 
 Module[
  {y, zsol, z, t},
  y = (Do some long integration);
  zsol = (solve an ode which depends on the value of y);
  z = z /. zsol;
  t = (do another long integration);
 (y + z + t)]

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 

From: Aaron Fude [mailto:aaronfude at yahoo.com]
To: mathgroup at smc.vnet.net

Hi,

How do you define a function with a very long body and a bunch of
intermediate results. For example

f[x_] := 

y = (Do some long integration)
z = (solve an ode which depends on the value of y)
t = (do another long integration)
assign (y + z + t) to f!!!

The idea is that a function is best read if it is broken up but the
parts are not important enough to be made into their own functions.

Thanks!

Aaron





  • Prev by Date: Re: Long function defintions
  • Next by Date: Re: extract all k-tuple from a list of n elements
  • Previous by thread: Re: Long function defintions
  • Next by thread: Q: extract all k-tuple from a list of n elements