2
$\begingroup$

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.

$\endgroup$
4
  • 3
    $\begingroup$ 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." $\endgroup$
    – rm -rf
    Commented Jun 28, 2012 at 17:44
  • 1
    $\begingroup$ 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. $\endgroup$
    – user21
    Commented Jun 28, 2012 at 17:52
  • $\begingroup$ @ruebenko Useful! Thanks! $\endgroup$
    – dearN
    Commented Jun 28, 2012 at 17:55
  • $\begingroup$ @ruebenko The //InputForm takes forever to crank though.. at least on my 2GB RAM Linux machine running Mathematica 7. $\endgroup$
    – dearN
    Commented Jun 28, 2012 at 17:59

1 Answer 1

6
$\begingroup$

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!

$\endgroup$
4
  • $\begingroup$ Will try your approach of compressing and exporting as a string. $\endgroup$
    – dearN
    Commented Jun 28, 2012 at 17:55
  • $\begingroup$ 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? $\endgroup$
    – dearN
    Commented Jun 28, 2012 at 18:01
  • $\begingroup$ @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. $\endgroup$
    – Szabolcs
    Commented Jun 28, 2012 at 18:03
  • 2
    $\begingroup$ @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. $\endgroup$
    – Szabolcs
    Commented Jun 28, 2012 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.