# Approximating solution of an equation: newton

### 10.3.1 Approximating solution of an equation: newton

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.

- Input:
  newton(x^2-2,x,1)
  Output:

  1.41421356237

- Input:
  newton(x^2-2,x,-1)
  Output:

  −1.41421356237

- Input:
  newton(cos(x)-x,x,0)
  Output:

  0.739085133215