Re: Calculate the first time, not each time (?)
- To: mathgroup at smc.vnet.net
- Subject: [mg94575] Re: Calculate the first time, not each time (?)
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 16 Dec 2008 06:04:18 -0500 (EST)
- Organization: Uni Leipzig
- References: <gi7ljg$cui$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
why not use dynamic programming ? Uns not a table but instead
the
shapeprimativeXvalues[v]:=shapeprimativeXvalues[v]=N[functionpX[v]]
this will remember the values already calculated and lookup the
values in a second call.
Regards
Jens
Michael Young wrote:
> Hello,
>
>
>
>
> I'm doing some engineering which will involve a large number of points
> -- and I anticipate time problems if all steps are repeated for each
> one. Here's an outline of the way I'd like to approach it.
>
>
>
> shapeprimativeXvalues := N[Table[functionpX[v], {v, vlimit}]]
> shapeprimativeYvalues := N[Table[functionpY[v], {v, vlimit}]]
>
>
>
> Arriving at these will involve some calculation, and once the results
> are in, it is unnecessary that the this be repeated when the values
> are used.
>
>
>
> adaptshapetoitslocation[v_] := (various operations on or including)
> shapeprimativeXvalues[[v]] (and or) shapeprimativeYvalues[[v]]
>
>
>
> Is there a way I can instruct Mathematica to evaluate a table, (value
> or function), once, when it is first called; then not to evaluate it
> again, but to pass numerical results on request?
>
>
>