How do I store the results of a long symbolic calc

2019-03-21 05:51发布

问题:

My calculations are something like this:

f[x_]:= (*runs fast*)
g[x_]:=(*runs fast*)
h[x_]=depends on f[x],g[x] (*runs slow ~5mins*)

Now I need only the results of h[x] and every time I restart mma, I essentially redo the same calculations to get h[x], when it could have been stored. Is there some way I can save the symbolic results, and just import it anytime I need it?

回答1:

Try Save

Use like:

Save["h-defs.m", h]

And load with Get:

<< "h-defs.m"