如何存储长符号计算的结果以备后用? [英] How do I store the results of a long symbolic calculation for later use?

查看:23
本文介绍了如何存储长符号计算的结果以备后用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算是这样的:

f[x_]:= (*运行速度快*)g[x_]:=(*跑得快*)h[x_]=取决于 f[x],g[x](*运行缓慢~5分钟*)

现在我只需要 h[x] 的结果,并且每次我重新启动 mma 时,我基本上都会重做相同的计算以获得 h[x],当它本来可以存储的.有什么方法可以保存符号结果,并在需要时随时导入它?

解决方案

尝试 保存

像这样使用:

保存["h-defs.m", h]

并加载获取:

<预><代码><<

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?

解决方案

Try Save

Use like:

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

And load with Get:

<< "h-defs.m"

这篇关于如何存储长符号计算的结果以备后用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆