# Saving/exporting results from FindInstance and similar functions

I am dealing with a problem that requires the use of both FindInstance and FindRoot nested in a non-trivial way. The result is dependent on some parameter value $t \in [0,1)$, therefore I use

sol[t_]:=FindRoot[...]


For each t, the calculation of the result takes about 2 minutes (for some values of t it's faster, for others slower), resulting in

Plot[sol[t], {t,0,1}]


to take several hours. As I want to do further calculations/plots with $sol$, I learned from a previous question that i can "save" the results obtained by using

sol[t_]:=sol[t]=FindRoot[...]


However, this still requires me to redo the calculations every time I start Mathematica or the kernel dies for some unexpected reason.

Is there a way to save/export the results obtained "within" $sol$, such that I can "load" them at the beginning of a session? (I apologize for the vague terms, please let me know if I need to clearify my question).

-
Have a look at DumpSave. –  b.gatessucks Feb 18 '13 at 8:40
–  Yves Klett Feb 18 '13 at 8:41
Thanks to you both, that's exactly what I was looking for. I guess I should have found this myself, but I was apparently not looking with the right search phrase. –  Mitch D Feb 18 '13 at 8:58
You are welcome. If your question is not found to be a duplicate, it will be useful if you write an answer yourself once you have found the right solution to help others benefit from your insights. –  Yves Klett Feb 18 '13 at 9:01
Changing your user name to something more individual should also help the overall look of the site and facilitate interaction. –  Yves Klett Feb 18 '13 at 9:03
show 1 more comment

As b.gatessucks and Yves Klett pointed out, 'DumpSave' is the solution. Taking what was written at Save interpolated function one can use

DumpSave["~/Desktop/solt.mx", sol]


to save and

DumpGet["~/Desktop/solt.mx"]


to load the results that where calculated while plotting the function $sol$.

Furthermore, as described at How to save all data in all variables so that loading it is fast? (and also the Documentation of DumpSave), by using

DumpSave["~/Desktop/dumpall.mx", "Global"]
`

the results and definitions of all symbols/functions are saved and can later be loaded using DumpGet.

-