Calculus 2 - Mathematics 120 -
Spring 2008
Syntax in Mathematics, Excel, and Mathematica
|
These questions are for you to become aware of some important differences
(and similiarites) between Excel,
Mathematica, and "standard" mathematical conventions.
- Does
equal
2^(3^4) or (2^3)^4? The answer depends on whom you ask. If you ask a
mathematician, it's 2^(3^4). If you "ask" Excel or Mathematica or
your calculator, you may get different answers.
Type 2^3^4, without any parentheses, into both Excel and Mathematica, to
determine whether each of them interprets it as 2^(3^4) or (2^3)^4. Then
record your answers in the following table. Fill out the rest of the table
too.
|
Mathematics |
Excel |
Mathematica |
2^3^4 |
2^(3^4) |
|
|
2 + 3 * 4 |
|
|
|
2 * 3 ^ 4 |
|
|
|
2 * 3 / 4 |
|
|
|
2 / 3 * 4 |
|
|
|
2 * - 3 |
|
|
|
2 + -3 |
|
|
|
2 - + 3 |
|
|
|
2 - * 3 |
|
|
|
- How do we compute cos(2) in Excel or Mathematica?
In Excel, you must use parentheses, but in Mathematica square brackets:
Excel: =COS(2) (If you don't capitalize, Excel will do it for you! But
don't forget the equal sign.)
Mathematica: Cos[2] (the C must be uppercase, the os must be
lowercase; otherwise Mathematica won't understand).
Is the 2 interpreted as radians or degrees in each software? How do you
know? Explain.
- In Mathematica, type in 2(5). Do you get 10?
Now do it in Excel: what does =2(5) give?
- In Mathematica, type in 2*5. Do you get 10?
Now do it in Excel: what does =2*5 give?
-
Try the following, in both Excel and Mathematica. (In Excel, prefix each
with an equal sign.)
2*(5+7) vs. 2*[5+7]
Cos(2) vs. Cos[2]
What did you get with each software?
- Fill out the following table.
Advice: It is often a good idea to use "unnecessary" but appropriatley placed
spaces and brackets for "easier human
readability"!
For example, x*y/z and (x*y)/z and x*y / z all
produce the same result; but the latter two are easier to read.
How do you write |
in
Excel?
|
in
Mathematica?
|
cos x |
|
|
cos(x + y) |
|
|
cos(xy) |
|
|
cos xy |
|
|
cos x y |
|
|
cos x + y |
|
|
 |
|
|
 |
|
|
Updated: 31 August, 2009 17:44:19