Groups | Search | Server Info | Login | Register
Groups > comp.soft-sys.math.mathematica > #16892
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to avoid repeated recalculation of the same function |
| Date | 2014-05-03 07:41 +0000 |
| Message-ID | <lk26je$12p$1@smc.vnet.net> (permalink) |
| References | <20140502061856.7A2216A46@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Did you try using Set ( = ) instead of SetDelayed ( := ) when defining f? That is, try: f[x_] = expression On May 2, 2014, at 2:18 AM, pgeipi10@gmail.com wrote: > Hi, > > I'm doing a calculaton that's purly symbolic (no graphing, numerical integration, etc.). > > Suppose I have a function f[x_]:=... that's very complex to build. In fact, f[x] ends up being a manageable expression (about 30 characters) but it takes Mathematica about 30 min to build that expression. > > Another function g[] uses the function f[x] and references it many times. I've discovered that g[] actually builds f[x] every time it's referenced which takes 30 minutes each time. Theoretically, Mathematica could build it once and then use the resulting expression every time it's referenced. > > So how do I accomplish that? That is, how do I make it build f[x] once and then use the resulting expression when it's needed? > > Thanks, > > > Pavel > Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 240 246-7240 (H) University of Massachusetts 710 North Pleasant Street Amherst, MA 01003-9305
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar
Re: How to avoid repeated recalculation of the same function Murray Eisenberg <murray@math.umass.edu> - 2014-05-03 07:41 +0000
csiph-web