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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.