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.

  • 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 Jun 28 '12 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 Jun 28 '12 at 17:52
  • $\begingroup$ @ruebenko Useful! Thanks! $\endgroup$ – dearN Jun 28 '12 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 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!

  • $\begingroup$ Will try your approach of compressing and exporting as a string. $\endgroup$ – dearN Jun 28 '12 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 Jun 28 '12 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 Jun 28 '12 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 Jun 28 '12 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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