### 23.3.1 Newton method

The newton command uses Newton’s method to approximate a solution to an equation.

- newton takes one mandatory argument and four optional arguments:
  - ex, an expression.
  - Optionally, var, the variable used in this expression (by default x).
  - Optionally, a, a number (by default 0)
  - Optionally, ε, a small number (by default 1e-8)
  - Optionally, nbiter (by default 12).
- newton(ex ⟨,var,a,ε,nbiter ⟩) returns an approximate solution of the equation ex=0 using the Newton algorithm with starting point var=a. The maximum number of iterations is nbiter and the precision is ε.

#### Examples

newton(x^2-2,x,1)

1.41421356237 |  |  |  |  |  |  |  |  |  |

newton(x^2-2,x,-1)

−1.41421356237 |  |  |  |  |  |  |  |  |  |

newton(cos(x)-x,x,0)

0.739085133215 |  |  |  |  |  |  |  |  |  |