MathGroup Archive 2004

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

Search the Archive

Re: Long function defintions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49660] Re: Long function defintions
  • From: BobHanlon at aol.com
  • Date: Tue, 27 Jul 2004 07:00:36 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

f[x_] := Module[{y,z,t,s},
       y= Integrate[3s^2,{s,0,x}];
       z= Integrate[4s^3,{s,0,x}];
       t= Integrate[5s^4,{s,0,x}];
       y+z+t];


f[x]


x^5 + x^4 + x^3


Bob Hanlon

> In a message dated Mon, 26 Jul 2004 08:43:08 +0000 (UTC), 
> aaronfude at yahoo.com writes:  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.
> 


  • Prev by Date: Using "Sum" (i = 1 ... N) in a function definition
  • Next by Date: Re: Q: extract all k-tuple from a list of n elements
  • Previous by thread: Long function defintions
  • Next by thread: Re: Long function defintions