2
$\begingroup$

As it is well known, it is possible to define a function that remembers its values once its evaluated, using the following code:

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

During the day I evaluate f[x], for many x's, and I do not know/remember at which values of x I evaluated this. These values wont need to be evaluated again until I close mathematica, but if I close it, they will be lost. Is there a way to avoid this? To store these values somehow, so that I can use them the next time I open mathematica?

$\endgroup$
  • $\begingroup$ save = DownValues[f] places the arguments and corresponding values of f in save. $\endgroup$ – bbgodfrey Jun 27 '18 at 3:57
  • 4
    $\begingroup$ Look at documentation for DumpSave $\endgroup$ – Bob Hanlon Jun 27 '18 at 4:56
  • $\begingroup$ @BobHanlon Much better than my answer. Thanks. $\endgroup$ – bbgodfrey Jun 27 '18 at 5:01
  • $\begingroup$ I think DumpSave is storing only the definitions of the functions. The evaluations seem to be lost $\endgroup$ – Fisher Jun 27 '18 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.