• Home
  • University of Queensland
  • Analysis Of Ordinary Differential Equations
  • Mathematica Basics for Calculus and Differential Equations

Mathematica Basics for Calculus and Differential Equations

A Mathematica Crib Sheet (But It's OK, You'll Need One) Mathematica is a full-featured programming language, with over 1500 commands built-in or in standard "packages". But it's like speaking English: an educated person probably knows a quarter of a million words, but only about a hundred and fifty different words are really needed to get through a whole week. Similarly, there are only a few commands that you'll need to run Mathematica well enough to learn calculus. Think of this sheet as an emergency road-side manual, dedicated to getting you "up and running." The Golden Rule: Try It! Instead of asking, "What happens if I ... ", do it! Experiment! Try commands out to see what they do. Try commands we haven't talked about. We promise: the computer won't catch fire, no matter how bad a mistake you make. (As long as it doesn't involve matches ... ) Four Mistakes You'll Make Over and Over! 1. To end input you must hit "Enter" or "Shift-Return," not just "Return." Commands to Mathematica can span multiple lines, so if you just hit "Return" Mathematica thinks you haven't finished typing the command for that input cell, and waits for you to continue. 2. Mathematica functions and procedures use square brackets around their arguments, not parentheses! 3. Mathematica is very sensitive to the case a word is typed in. All Mathematica functions and procedures start with capital letters, but the rest of the letters must be lower-case, unless they effectively start a new word - for example, FactorInteger. 4. Ending an expression with a semicolon tells Mathematica to suppress that output. If you're not getting any answers at all, check for semicolons. Getting Help from the Computer There are two important tricks to keep in mind: 1. If you want to know something about a Mathematica function or procedure, just type a question mark followed by the name of the procedure. Example: ?FactorInteger After you press Enter Mathematica responds: FactorInteger [n] gives a list of the prime factors of the integer n, together with their exponents. To get still more help, type two question marks in front of the name. 2. If you can't remember the full name of a Mathematica function or procedure, but can remember a few letters at the start, there is a "fill-in" capacity: after typing a few letters, type command-K (simultaneously press down the "open apple" key, located next to the space bar, with the letter "K"). Mathematica will either finish typing the name for you - if there is only one command which starts with those letters - or will present you with a "pop-up menu," a list of possible matching commnads. By clicking on one of these you select the complete command. Some Common Mathematica Functions x^y x* y x y 2 x Sqrt [x] Exp [x] Log [ x] Log [b, x] Sin [x], Cos [x], Tan [x], Csc [x], Sec [x], Cot [x] ArcSin [x] , ArcCos [x], ArcTan [x] , ArcCsc [x], ArcSec [x],