TransWikia.com

Exporting/saving a table of Interpolated functions

Mathematica Asked on June 14, 2021

I have a lot of interpolated functions that I have generated from a numerical integral. It takes me 2 hours or so to generate them so I would prefer to save and import them.

I have tried Export[...] and DumpSave[...]. DumpSave[...] works for a single Interpolation[...] ut not for a table of them.

Does anyone have a suggestion on how to export a table of interpolated functions?

One Answer

guidance to your comment:

define some user functions sin,cos

data

= Table[{x, Sin[x], Cos[x]}, {x, Subdivide[0, 2 Pi, 50]}]; sin = Interpolation[data[[All, {1, 2}]]]; cos = Interpolation[data[[All, {1, 3}]]];

save the functions

DumpSave["sincos.mx", {sin, cos}]

Clear[sin,cos] (* new session*)

load function

Get["sincos.mx"]

now the loaded functions are available

Plot[{sin[x], cos[x]}, {x, 0, 2 Pi}]

That's it!

enter image description here

Answered by Ulrich Neumann on June 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP