# Opening .nb in other software or exporting to other languages

I am collaborating on a spare-time project with someone else that has access to Mathematica. I do not. He has supplied me with his notebook file. Is it possible for me to open, or import this file in any other piece of software?

If not, are there any options to export from Mathematica to another format or language? I have heard that it is possible to export from a .nb file to C/C++ code, but I don't know if my co-conspirator can do this or what the best options are.

For my specific case, export to C++ would be ideal.

-
The Wolfram CDF player should allow you to at least view the document, but not execute any of the code. If your co-conspirator has used a lot of dynamic content, this option will not be of much use. –  bobthechemist Jul 11 '13 at 12:49
converting to C or anything else is generally a highly non-trivial (if not impossible) task, even if you have Mathematica. Only if you have individual expressions that are close to making sense in the traditional language can you 'convert'.. –  george2079 Jul 11 '13 at 12:58
Alternatively, you could ask your collaborator to save the notebook as a .cdf format, then you can see in the player (more-or-less) whatever he sees in the notebook. –  bill s Jul 11 '13 at 15:07

Is it possible for me to open, or import this file in any other piece of software?

The answer to that question is surely yes, because normal notebooks are text-files which can be opened with any text-editor at your disposal. If you'd asked whether it will be of much use for you, then I would tend to say no.

A notebook often used not only to put algorithms and functions in, but rather it contains a lot of test and example code, e.g.

• plotted curves and surfaces to help understanding or to gain further insight
• dynamicly changeable content for demonstration purpose (like on demonstrations.wolfram.com)
• output of functions were you tested whether your programs are working correctly
• partially styled text to document or explain things (this can be mixed with normal code)
• some meta-information about the notebook itself

such things, especially the dynamic and graphical stuff are, although correct Mathematica syntax, highly condensed and hard to read even for advanced users. This will make it almost impossible to separated the things you want to know from the rest. To view such a file, I would suggest you download the Free Wolfram Player which lets you view the contents as you would see it in Mathematica. You cannot change or execute something and there are some further issues, but this is what I would try first.

If your friend would make the effort to put the important function definitions in a package file, it would help you very much. A package file (*.m) is a normal Mathematica file too, but it often contains only the function definitions which are then loaded into a Mathematica session.

With such a file, the usage of a normal editor makes more sense and there, you have several options

I don't know how much you can understand Mathematica code without knowing the language, but maybe you like it and consider buying a student semester license for ~35 Euro.

-