Subject: Telling Maxima to Cache results of evaluations
From: Stavros Macrakis
Date: Thu, 4 Apr 2013 17:33:03 -0400
Yes, Maxima has "memoizing functions". Define your function as H2[Q,s] :=
... and it will remember all previously-calculated results. To remove the
calculated results, you'll have to kill(H2) and define the function again
if necessary.
Example:
---Pure functional version---
fib(i):=if i<2 then 1 else fib(i-1)+fib(i-2);
fib(25);
Evaluation took 2.6930 seconds (2.7210 elapsed) using 66.683 MB.
---Memoizing version---
fibm[i]:=if i<2 then 1 else fibm[i-1]+fibm[i-2]
fibm[25];
Evaluation took 0.0000 seconds (0.0000 elapsed) using 0 bytes.
On Thu, Apr 4, 2013 at 4:56 PM, Adrian Brown <abrown at seti.org> wrote:
> Hi all,
>
> I have a numerical integration that takes about 4 seconds to run, I have
> to call it 1700 times, Maxima knows the function as H2(Q,s) but very often
> the input parameters are the same and I was hoping maxima would not
> evaluate the numerical integration again, but just use a cached result.
>
> Does Maxima have this capability and how do I enable it? I have searched
> through the manual and mailing list but surprisingly to no avail.
>
> Any help gratfully appreciated.
>
> Adrian
>
> --
> http://www.google.com/search?**q=adrian+brown<http://www.google.com/search?q=adrian+brown>
>
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>
>