This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / The Mathematica Book / A Practical Introduction to Mathematica / Numerical Calculations /

1.1.3 Some Mathematical Functions

Mathematica includes a very large collection of mathematical functions. Section 3.2 gives the complete list. Here are a few of the common ones.

Some common mathematical functions.

Two important points about functions in Mathematica.

It is important to remember that all function arguments in Mathematica are enclosed in square brackets, not parentheses. Parentheses in Mathematica are used only to indicate the grouping of terms, and never to give function arguments.

This gives . Notice the capital letter for Log, and the square brackets for the argument.

In[1]:= Log[8.4]


Just as with arithmetic operations, Mathematica tries to give exact values for mathematical functions when you give it exact input.

This gives as an exact integer.

In[2]:= Sqrt[16]


This gives an approximate numerical result for .

In[3]:= Sqrt[2] //N


The presence of an explicit decimal point tells Mathematica to give an approximate numerical result.

In[4]:= Sqrt[2.]


Since you are not asking for an approximate numerical result, Mathematica leaves the number here in an exact symbolic form.

In[5]:= Sqrt[2]


Here is the exact integer result for . Computing factorials like this can give you very large numbers. You should be able to calculate up to at least 2000! in a short time.

In[6]:= 30!


This gives the approximate numerical value of the factorial.

In[7]:= 30! //N


Some common mathematical constants.

Notice that the names of these built-in constants all begin with capital letters.

This gives the numerical value of .

In[8]:= Pi ^ 2 //N


This gives the exact result for . Notice that the arguments to trigonometric functions are always in radians.

In[9]:= Sin[Pi/2]


This gives the numerical value of . Multiplying by the constant Degree converts the argument to radians.

In[10]:= Sin[20 Degree] //N


Log[x] gives logarithms to base .

In[11]:= Log[E ^ 5]


You can get logarithms in any base b using Log[b, x]. As in standard mathematical notation, the b is optional.

In[12]:= Log[2, 256]