MathGroup Archive 2005

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

Search the Archive

Partial evaulation of function terms

  • To: mathgroup at
  • Subject: [mg53230] Partial evaulation of function terms
  • From: Erich Neuwirth <erich.neuwirth at>
  • Date: Sun, 2 Jan 2005 04:12:39 -0500 (EST)
  • Sender: owner-wri-mathgroup at

I have the following function definition

ParFun[amps_, freq_] := Function[t, Sum[amps[[i]]*Sin[2*Pi*freq*i*t], {
     i, Length[amps]}]]

Then, the following works:

Sin[440*Pi*t] + Sin[880*Pi*t]/2

Function[t$, Sum[{1, 1/2}[[i]]*Sin[2*Pi*220*i*t$], {i, Length[{1, 1/2}]}]]

Is there a way to force Mathematica to evaluate all
subterms which already can be evaluated?
This function will be called in Play very often, so it would make things 
much faster if you could assign the function with all possible
constants evaluated to a local variable and do the many calls to the 
function for producing numerical values with the "partially 
preevaluated" expression.

  • Prev by Date: Re: mathematica parser
  • Next by Date: Re: Slowdown
  • Previous by thread: Re: For to Map to Increase Speed
  • Next by thread: Re: Partial evaulation of function terms