I have bkwrd compatibility issues when I save my NDSolve result (which is an interpolating polynomia) using DumpSave from Mathematica 8 on Windows 7 and then try loading it using Mathematica 7 on Linux.
Is there any way I could specify backward compatibility (and cross compatibility: files can be imported into different OS with or without the same version of mathematica) in DumpSave?
I have read this and this but they don’t address the same issue.
Also, is there anyway the interpolating functions can be saved in a human readable format?
Example code to work on, for convenience.
Compatibility in DumpSave? As I recall, it is to be used only with your machine. See the docs: “Files written by DumpSave can only be read on the same type of computer system on which they were written.”
– R. M.♦
Jun 28 ’12 at 17:44
Depending on the equation you solve with NDSolve the functionality needed to make the interpolation function may not exist in older versions. To look at it in human readable form you could use InterpolationFunction[..]//InputForm perhaps that helps.
Jun 28 ’12 at 17:52
@ruebenko Useful! Thanks!
Jun 28 ’12 at 17:55
@ruebenko The //InputForm takes forever to crank though.. at least on my 2GB RAM Linux machine running Mathematica 7.
Jun 28 ’12 at 17:59
The MX format (that is written by DumpSave) is not portable between different computer systems. One can’t count on it being compatible either between versions, different OSs or different architectures (32 vs 64 bit).
I recommend that you use Compress and export the results as a string instead, as I described here. This is not as fast as saving to MX, but it has quite good performance, and good compatibility. (Note though that previous versions may not be able to handle certain data structures, e.g. Graph, even if they can load the file!)
Also, a warning: if you are saving interpolating functions, be sure to read about this problem!
Will try your approach of compressing and exporting as a string.
Jun 28 ’12 at 17:55
In Export[“data.mmaz”, Compress[expression], “String”] expression = Uncompress@Import[“data.mmaz”, “String”] , what is expression? The expression that has the interpolating polynomial assigne to it?
Jun 28 ’12 at 18:01
@DNA Both MX and this Compress trick are ways to save arbitrary Mathematica expressions. WDX or Package would have worked too as Export formats, but they’re much slower to import/exports.
Jun 28 ’12 at 18:03
@DNA The expression that you want to export, in this case the interpolating polynomial. This kind of exporting is analogous to Export, not DumpSave. See this answer to understand the difference.
Jun 28 ’12 at 18:04