Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
3  
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." –  rm -rf Jun 28 '12 at 17:44
1  
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. –  user21 Jun 28 '12 at 17:52
    
@ruebenko Useful! Thanks! –  drN 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. –  drN Jun 28 '12 at 17:59
add comment

1 Answer

up vote 5 down vote accepted

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!

share|improve this answer
    
Will try your approach of compressing and exporting as a string. –  drN 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? –  drN 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. –  Szabolcs Jun 28 '12 at 18:03
2  
@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. –  Szabolcs Jun 28 '12 at 18:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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