Import and ExportA very visible change to the core system is the support for import and export of a number of file formats which should make it easy to interface with a wide variety of other systems. Currently some 25 different formats are supported, covering such areas as raster graphics, vector graphics, animation, sound, numeric data, textual data, and document formats, as well as binary data. General
The general framework is to use only two functions:
For most of these formats there is additional information available under Additional Information in the Reference Guide for Export and Import. For instance many of these formats have additional options that control their use, such as picking a browser-safe color map when saving a GIF file, and these are documented in the Reference Guide entry above. GraphicsThis first example is the original data for the cat used in the Tour of Mathematica. And judging from questions coming into Wolfram Research, many users wanted to perform the manipulations shown there.
Below are some other common raster graphics formats, TIFF and JPEG.
Below is an example of a resolution independent (or vector) graphics representation, in this case PostScript.
AnimationAnother useful pedagogical tool is to be able to work with animations. Right now, animated GIFs are what works well with the web, and you can import and export these in Mathematica 4. This is a simple illustration of the convergence of a Fourier series.
This can be exported using various options to control its appearance such as whether it loops and the delay between images.
Sound
There are also a number of (sampled) sound file formats. The formats supported include;
Data
Mathematica 4 supports two common numeric data file formats: Another common way of getting data is as some form of textual file.
. Semi-Major Orbit Equator Rotate . Distance Period Radius Period Object (1000km) (days) (km) (days) ------- ------- -------- ----- ------- Mercury 57910 87.969 2439 58.65 Venus 108200 224.701 6052 -243.16 Earth 149600 365.256 6378 0.99 Mars 227940 686.980 3397 1.03 Ceres 413400 1681.25 470 0.38 Jupiter 778330 4332.59 71492 0.41 Saturn 1429400 10759.20 60268 0.45 Uranus 2870990 30684.9 25559 -0.72 Neptune 4504300 60190.3 24764 0.67 Pluto 5913520 90465. 1160 -6.39
There are two formats, "
One can also read data as a pure textual file. The formats: "
Another common case is to have a binary data file format. In Version 4 there are two
DocumentsThe main document formats into which notebooks can be converted are and HTML, both of which have been greatly enhanced in Version 4. These formats are designed to preserve much of the look and feel of the original notebook document, but there are, of course, obvious limits to what can be achieved for these formats in that regard. In both cases these conversions are extensible and there is additional information available on how this works in the corresponding reference guide entries. In the case of there is now a version of the Mathematica fonts that fits with modern distributions and allows these documents to preserve much of the look and feel of a typical notebook document. Below is an example where HTML + MathML is being exported instead of the usual HTML + GIF. The portion containing the MathML markup has been extracted from resulting string.
<math> <msup> <mrow> <mo>(</mo> <mrow> <mi>x</mi> <mo>+</mo> <mi>y</mi> </mrow> <mo>)</mo> </mrow> <mn>2</mn> </msup> </math>Copy and paste this piece of MathML into Mathematica 4. You will see that the expression is automatically converted into a formula in TraditionalForm. This is a preview of what the web will likely eventually be, where a formula is more then a graphic image, and you can actually manipulate and compute with it, as you can right now in Mathematica. Compare this output to the box representation used by Mathematica. Apart from additional markup in MathML such as <mi> for math italic variables and <mo> for math operators these expressions are structurally identical.
This is, of course, no accident, since Wolfram Research has been closely involved in the MathML design from the very start. And in addition we are hosting a conference on MathML in the fall of 2000. Converted by Mathematica June 4, 2000 |