Partial evaulation of function terms
- To: mathgroup at smc.vnet.net
- Subject: [mg53230] Partial evaulation of function terms
- From: Erich Neuwirth <erich.neuwirth at univie.ac.at>
- Date: Sun, 2 Jan 2005 04:12:39 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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: ParFun[{1,1/2},220][t]//InputForm Sin[440*Pi*t] + Sin[880*Pi*t]/2 but ParFun[{1,1/2},220]//InputForm yields 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.
- Follow-Ups:
- Re: Partial evaulation of function terms
- From: DrBob <drbob@bigfoot.com>
- Re: Partial evaulation of function terms
- From: yehuda ben-shimol <benshimo@bgu.ac.il>
- Re: Partial evaulation of function terms