MathGroup Archive 2002

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

Search the Archive

Placing parameters in memory

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33832] Placing parameters in memory
  • From: <bradamanteus at yahoo.com>
  • Date: Fri, 19 Apr 2002 02:28:13 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

My problem is likely to have a simple answer:

I have a lot of fixed parameters in a program that are recall numerous
times.  The run command is something like this:

run["test.m", 10, t -> 10, u -> 4, v -> 0.4, w -> 0.05]

where I can set values for t, u, v, w which are the parameter options.

To reduce the time of the run I wanted to place the parameters in memory.

I added a line

f[x_]:=f[x]=x

and wrapped all the parameters in my code in f[]:

e.g.

f[t] instead of t

But now when I run the simulation, it actually takes 20% longer to run
rather than being quicker!

My function f has memorized values like these:

?f

f[10]=10
f[4]=4
f[0.4]=0.4
f[0.05]=0.05


But have I actually made any short cuts in this process? It seems like when
the program calls on f[t],f[u],f[v] or f[w] it is not yet in memory and
still has to be calculated...?

What is the best way to set parameter options into the memory of
mathematica?


thanks

Leanne.
Newbie




  • Prev by Date: Re: Evaluation of Conditional Definitions(2)
  • Next by Date: Reading Data into Mathematica
  • Previous by thread: Re: Re: Evaluation of Conditional Definitions(2)
  • Next by thread: Reading Data into Mathematica