Wolfram Mathematica is not just a system that can solve almost any mathematical task. It is a Swiss army knife, which allows you to process images, audio, and written text to perform classification and identification of objects, as well as to manage files. It also provides other tremendous capabilities. In Mathematica, you can call functions, as well as receive a call from modules that are written using different programming languages and technologies, such as C, .NET, Java, and others. The system can generate code and compile files. Mathematica includes over 4,500 functions, which go beyond mathematical calculations. Wolfram Mathematica is constantly changing while still maintaining full compatibility with previous versions.
In this chapter, you will learn the following:
How to install the Wolfram Mathematica system
How to configure it to fit your needs
What the Wolfram language kernel is and how to run it
Wolfram Mathematica features to write expressions
Depending on your needs, you can work with Mathematica both online and offline. For a deeper understanding of the system and its settings and capabilities, we will use the offline version. In this book, we'll deal with examples of Mathematica, version 10.2 (the current version at the time of writing this book), which are fully compatible with all future versions.
You can install Mathematica on the major operating systems: Windows, Linux, and Mac OS X.
To download a trial version of Mathematica, use this link: https://www.wolfram.com/mathematica/trial. You will be prompted to create a new Wolfram Mathematica ID or sign in with your already registered ID:
After registration, you will receive an e-mail containing the link to activate your Wolfram ID, as well as the link to access Mathematica Online. Activate your account and log in using https://user.wolfram.com/portal/login.html.
Let's download the Windows version of the program (by clicking on the Download for Windows button) and go through the main stages of system installation on a computer. The size of the downloaded file will be slightly larger than 2 GB, so make sure you have enough free space on your computer, both for the installer and for the installation of Mathematica.
In the next dialog window, as shown in the preceding screenshot, you should choose the components of Mathematica you want to install. The Wolfram Extras package includes plugins for browsers that allow you to preview the Mathematica files embedded in web pages.
To continue the installation, click on the Next button.
After that, we will see the summary of the previously selected options as shown in the preceding screenshot. Click on the Install button to start copying the files. After all files are copied, you will be notified that the installation is finished. You can check off the Launch Wolfram Mathematica checkbox to start learning the system immediately:
Once the system launches, you need to enter the activation key that we copied from the Wolfram website earlier:
Read the license agreement and check the I accept the terms of this agreement box. Then click on OK.
Let's review the most interesting settings of the system, which will be useful for our further work:
In the Appearance | Number | Formatting tab, you can select various numeric formatting options. Will there be a space separator between the digit blocks? What should be the decimal point character? How many digits will be displayed by default in the output?
In the next Multiplication tab, you can select the appearance of the multiplication:
The Wolfram system has a modular structure and consists of two main parts. The one that directly performs all computations is called the kernel; the other part that interacts with the user is called the front end.
In order to connect multiple kernels, navigate to Evaluation | Kernel Configuration Options… and click on the Add button.
In the dialog window that opens, you can select whether the kernel will be located on a local computer or on a remote computer in the network. You can also enter the parameters in order to connect to this computer. There is a capability to be always aware of which kernel was used for computations.
Let's get acquainted with some distinctions of Mathematica that will help us to understand the source code in the following chapters.
Let's create our first notebook. When Mathematica starts, you should choose New Document and then Notebook.
In:= 1 + 4 Out= 5
All built-in functions always start with a capital letter, as shown here:
No variables should start with a number, since it will automatically be treated as a multiplication operation. They cannot end with a $ symbol.
If the variable ends with
_, then it is a template expression and it can be substituted with anything, for example:
The difference is that in a delayed assignment, the right-hand side of the expression is always recomputed if the function is called. In an absolute assignment, the value that was in place during the assignment is stored.
In order to use the result of the preceding expression, one can use the
In this chapter, we learned how to install the Wolfram Mathematica software and reviewed the basic components of the system: front end and kernel. We also gained a knowledge of the Mathematica language features.
In the next chapters, we will review additional features and techniques that facilitate work in Mathematica.