Numerical Calculations
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.
N[expr] | numerical value of an expression |
NIntegrate[f,{x,xmin,xmax}] | numerical approximation to ![]() |
NSum[f,{i,imin,Infinity}] | numerical approximation to ![]() |
FindRoot[lhs==rhs,{x,x0}] |
search for a numerical solution to an equation, starting with
![]() |
NSolve[lhs==rhs,x] | numerical approximations to all solutions of an equation |
FindMinimum[f,{x,x0}] | search for a minimum of f, starting with ![]() |
NMinimize[f,x] | attempt to find the global minimum of f |
In[1]:=1

✖
https://wolfram.com/xid/0b3etlgqihsj-haa
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/0b3etlgqihsj-vu5
Out[2]=2

N[expr] gives you a numerical approximation:
In[3]:=3

✖
https://wolfram.com/xid/0b3etlgqihsj-oj9
Out[3]=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.
In[4]:=4

✖
https://wolfram.com/xid/0b3etlgqihsj-jlo
Out[4]=4

You can use N to get an approximate numerical result:
In[5]:=5

✖
https://wolfram.com/xid/0b3etlgqihsj-oyl
Out[5]=5

NIntegrate does the integral numerically from the start:
In[6]:=6

✖
https://wolfram.com/xid/0b3etlgqihsj-j8c
Out[6]=6
