Mathematica 9 is now available

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

1.6.1 Basic Operations

Exact symbolic results are usually very desirable when they can be found. In many calculations, however, it is not possible to get symbolic results. In such cases, you must resort to numerical methods.

Basic numerical operations.

Mathematica maintains this expression in an exact, symbolic, form.

In[1]:= (3 + Sqrt[2])^3

Out[1]=

You can even use standard symbolic operations on it.

In[2]:= Expand[ % ]

Out[2]=

N[expr] gives you a numerical approximation.

In[3]:= N[ % ]

Out[3]=

Functions such as Integrate always try to get exact results for computations. When they cannot get exact results, they typically return unevaluated. You can then find numerical approximations by explicitly applying N. Functions such as NIntegrate do the calculations numerically from the start, without first trying to get an exact result.

There is no exact formula for this integral, so Mathematica returns it unevaluated.

In[4]:= Integrate[Sin[Sin[x]], {x, 1, 2}]

Out[4]=

You can use N to get an approximate numerical result.

In[5]:= N[ % ]

Out[5]=

NIntegrate does the integral numerically from the start.

In[6]:= NIntegrate[Sin[Sin[x]], {x, 1, 2}]

Out[6]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.