- Is there a command window and an editor in Mathematica 8 similar to those in Matlab? In Mathematica GUI mode, all I saw is write code and run it in the same notebook.
In my Ubuntu terminal, I successfully started Mathematica by
./math(which is the only way I know by the way and I would also like to know what options are available when starting up).
Is it correct that there are exactly two ways of running Mathematica code: in a notebook, and in a Mathematica session running in my Linux terminal?
Are the notebook way and the GUI mode the same thing?
What does "kernel" mean in Mathematica?
What are some basic concepts and common sense of running Mathematica?
Heike's code produces a graphics output. So if you run it inside a raw kernel (which is what the
As for the rest of the questions, I'll refer you to the official documentation that Sjoerd shared, as there is no need to duplicate information.
You can start a standalone kernel which pretty much behaves like a very rudimentary command line window. The normal FrontEnd (the "notebook interface") is an extra program which basically is the standard editor but also allows to send pieces of code to an (or several) connected kernels. For the communication these two programs actually don't use the command line interface you see when starting a standalone kernel but a more structured protocol called MathLink.
A notebook file opened in the FrontEnd (= the notebook interface) behaves very similar to a matlab script file with cell mode enabled, where you also can send the code within a "cell" to the kernel. The main difference is that the output will be shown in the command line window (and needs to be saved in an extra file if you want to keep it) in matlab but will be shown in the notebook right below the evaluated cell in Mathematica and become part of that notebook file. Another big difference is that the Mathematica FrontEnd is really a standalone program and you can quit the kernel and start another one from within the FrontEnd, whereas to restart the "matlab kernel" you'll need to restart the matlab graphical user interface.
Especially when you edit .m-package files (not the .nb-notebook files) with the frontend what it does technically is very similar to the matlab editor: in both cases there is some "markup" code inserted into the text file which the editor uses to structure and format the text to show. The notebook file format is somewhat more involved and has AFAIK no real counterpart in matlab, what probably comes closest (but not really) are the matlab "notebook files" which can be used to prepare your matlab code for publishing with html- and latex-formatted comments, but a Mathematica notebook is like a WYSIWYG version of that which will additionally allows for interactive content (see
By using the comand line interface or the mathlink protocol (along with some of the higher level variants like JLink or NETLink) there are in fact infinitely many possibilities to run Mathematica code, there is e.g. a Mathematica mode for emacs or webMathematica, which lets you embedded Mathematica code in html to be executed on a webserver. If you are looking for an interface that is more like what you are used to from matlab you could also have a look at Wolfram Workbench, which is basically a Mathematica plugin for the eclipse IDE.
But I think especially for a beginner it is much better to get familiar with the normal notebook interface, otherwise you'll stumble across peculiarites like the graphics output every now and then. Just because the notebook interface is different from what you have seen before doesn't mean it's bad: in fact I think that for a great many use cases the concept of the notebook interface has big advantages and only by making use of these you'll get the most out of Mathematica's possibilities. If you don't engage in the "Mathematica way" and use it just like matlab with a different syntax you can't expect to gain very much except of wondering about oddities.
A different interface (like the workbench or the command line interface) only seems to make sense when you have very special demands, e.g. you are writing more involved packages for others to use or you need to run large jobs using a job queuing/scheduling system.
When you see Mathematica for the first time you try to fit it into the mental model of how software works. While doing that, one of the first things people do is to try to classify Mathematica as a GUI program or as a command line program. Mathematica is unique in that it is both at the same time. For example, commands can take graphics as arguments.
Mathematica has two separate components: The Kernel and the Front End. When you run Mathematica inside a terminal window you are only running the kernel. The kernel let's you do any calculation but you will be lacking the interactive features.