Of course, Mathematica has more built-in functions than simply Sqrt. For
example, it has all of the usual trigonometric functions and their inverses:
Sin ArcSin Sec ArcSec
Cos ArcCos Csc ArcCsc
Tan ArcTan Cot ArcCot
These functions deal with angles measured in radians, not in degrees.
Mathematica also knows about the constant Pi, which makes it easier to pose
questions that deal with radians. Notice that Pi is spelled with a
capital ``P'' followed by a lower-case ``i''. This is important to remember.
Let's try to find out the value of Pi by asking Mathematica about it:
Pi
Notice that Mathematica refuses to tell us anything about the value of Pi. In
effect, it tells us that Pi is Pi. Why is that?
Click here for the answer
The important thing to realize is that Mathematica treats Pi as an exact number by
representing its value with a symbol instead of with a number. Let's
experiment with asking Mathematica some questions using the trig functions. For
example, let's start with the cosine of zero.
Cos[ 0 ]
Mathematica obliges with an exact answer, since the cosine of zero happens to be an
integer. Now let's try to find out the cosine of 1 radian.
Cos[1]
Because we are taking the cosine of an integer, Mathematica insists on giving us an
exact answer. The best it can do is tell us that the cosine of one is the
cosine of one, much as it did with the square root of two. Of course, we can
get a floating point approximation if we use a decimal point in the question.
Cos[ 1. ]
Since Pi is an exact number, we should expect to get back exact answers when we
ask questions involving Pi.
Cos[ Pi/2 ]
And voila, we get back the exact answer. (Recall that Pi/2 radians is 90
degrees.) How about the cosine of 60 degrees?
Cos[ Pi/3 ]
Again, the expected exact answer. How about the cosine of 45 degrees?
Cos[ Pi/4 ]
Things are really getting interesting! The answer isn't an integer or a
rational number, but Mathematica gives us an exact answer anyway: the square root of
two over two, which is equal to one over the sqaure root of two. We can also work backwards.
ArcCos[ Sqrt[2]/2 ]
This time we get an exact answer that involves the exact number Pi. Notice
what happens, though, if we use floating point numbers instead of integers.
ArcCos[ Sqrt[2. ]/2. ]