Mathematica Basics - Arithmetic
Introduction
Mathematica has been described by some as the world's most expensive calculator. While this description doesn't pay such a powerful program the tribute it deserves, it can certainly be treated as an on-line calculator, and that's basically what we're going to be doing in this laboratory.
The Arithmetic Commands
Now let's quickly go over the symbols used when doing basic arithmetic with Mathematica:
- + simply means plus, as you'd expect.
- - means minus.
- * means times.
- / means divide.
- ^ means raise to the power of. On the keyboard it is SHIFT-6.
- ! means factorial, as you'd expect.
- %, the percent sign, refers to the previous result. On the keyboard it is SHIFT-5.
- N[...] is a function which takes the decimal value of whatever is placed inside the brackets in place of the dots.
- Pi means the Greek letter π, and has its usual mathematical meaning in Mathematica of approximately 3.14159, or the circle’s circumference/diameter ratio. Mathematica is case-sensitive, so make sure you capitalize the "P". (Alternatively, on the Macintosh keyboard, you may use the option-p key combination to produce the π symbol, instead of typing out its name, or even choose the character from the appropriate pallette.)
- E means the base of the natural logarithm, called e in most written mathematics, and approximately 2.71828.
Note: All of Mathematica's built in functions start with a capital letter. Get used to it.
Evaluating Commands
There's one last thing you should be aware of before we dive into a real notebook. In order to tell Mathematica that you want it to actually evaluate what you have typed, hit the ENTER key over on the extreme right side of your keyboard on the numeric keypad.
Do not confuse this with the RETURN key, which merely starts a new line of text. (Mathematica commands can span many lines if you want them to.) It should be noted, however, that SHIFT-RETURN will work the same as the ENTER key
You're about to do the easiest laboratory exercise of the course, so don't panic too much.
You can now switch to an actual Mathematica practice notebook by clicking on the icon on the left. It may take a while to start up! Don't forget to come back here when you're done! (You can also return here just to reread the instructions.) See you in a few minutes.
Welcome back! You may be wondering how well you did. Click on the icon on the left to see the answers you should have gotten. (Only the answers are given, so if you don't match our results you need to figure out what you did wrong.)
You've now finished learning the Basics of Arithmetic in Mathematica. You may next go to the Table of Contents for the Mathematica Basics Labs, or go to the Table of Contents for all of the Differential Equations Labs, or simply quit.