Mathematica/Notebook

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Mathematica has, since its creation, advanced rapidly as a system for Scientific and Technical publishing. Because of this, its basic facilities for the creation and management of 'code' are tightly coupled with those features used for production of presentations and publications. This has made it an extremely attractive system to those who wish to experiment as they write.

With the Notebook interface, one may

  • Write publication quality text
  • Experiment with the entire Wolfram Language
  • Create publication quality Visualizations
  • Embed data in a structured manner

Such features require a bit more than the usual line oriented source code editor with which many of us are familiar. With the inclusion of direct support for Wolfram Alpha, there is a rich capability that goes far beyond than that which is immediately apparent to the first time user.

When opening a blank Mathematica Notebook, there are a few things going on that a first time user might not expect.

Each so-called 'line' within a Notebook has information associated with it that is not show by default. Below, you may see what is actually stored within a document after the user has inserted a single, blank line.

Cell[BoxData["\[IndentingNewLine]"], "Input"...
 CellChangeTimes->{3.683148855629257*^9}]

...after entering a simple calculation...

Cell[BoxData\[
 RowBox[{"2", "+", "2"}]], "Input",
 CellChangeTimes->{3.683148855629257*^9, {3.6831491544597797`*^9, 3.683149177585519*^9}}]

... And, after executing that line using SHIFT-ENTER.

Cell[BoxData[
 RowBox[{"2", "+", "2"}]], "Input",
 CellChangeTimes->{3.683148855629257*^9, {3.6831491544597797`*^9, 3.683149177585519*^9}}]

Cell[BoxData["4"], "Output",
 CellChangeTimes->{{3.683149161939064*^9, 3.6831491686292057`*^9}}]

If you have had some experience with Mathematica, you will immediately note that everything shown is a valid statement within the Wolfram language. Thats because, to Mathematica and many other so-called Functional Languages, code is no-different than data. As data, its meant to be manipulated in whatever manner best allows the user to achieve the results that they desire.

That being said, none of the what is depicted above is necessary for Wolfram code to execute. Neither is the Notebook Interface required to develop Mathematica solutions. Indeed, you may write Mathematica programs using any standard text editor. Including favorites such as vi, Emacs, or, for Windows users, Notepad.

Note that other Applications have recently implemented features that are similar to Mathematica's notebook interface. On Macintosh Xcode, Apple's Integrated Development Environment (IDE), has had a feature called Playground since version 6. Xamarin Studio, has its Sketch feature. And, still other IDE's such as Visual Studio, Eclipse, and JetBrain's Intelli-J Idea, all have various integrated and 3rd party solutions whose purpose to allow users to see what happens immediately when they type a line, or lines, of code.