# Newton's-Method

## Graphical calculator for the Newton method

The diagram shows the chosen number of iteration steps from the start value in linear lines. The dotted lines show the start value of the next iteration step. You can grap the start point in the diagram and move along the function.

Scale:
Number of iterations=
Start value x0=
Number of digits=
Function f(x):
Linear line:

Parameter values

a=
b=
c=

Axes ranges

x-min=
x-max=
y-min=
y-max=

Parameter ranges

a-min=
a-max=
b-min=
b-max=
c-min=
c-max=

## Calculated iterations with Newton method

$f\left(x\right)=$

 clear Calculate Pos1 Ende 7 8 9 / $x$ $y$ $z$ 4 5 6 * ( ) 1 2 3 - a b c 0 . + $\mathrm{sin}$ $\mathrm{cos}$ $\mathrm{tan}$ ${e}^{x}$ $\mathrm{ln}\left(x\right)$ ${x}^{a}$ ^ $\mathrm{asin}$ $\mathrm{acos}$ $\mathrm{atan}$ ${x}^{2}$ $\sqrt{x}$ $\sqrt[3]{x}$ $\sqrt[4]{x}$ $\frac{\left(\right)}{\left(\right)}$ $\mathrm{sinh}$ $\mathrm{cosh}$ $\frac{ax+c}{bx+c}$ $\frac{a+x}{b+x}$ $\frac{{x}^{2}-{a}^{2}}{{x}^{2}+{a}^{2}}$ $\frac{1}{a+bx}$ $\frac{1+\sqrt{x}}{1-\sqrt{x}}$ $\sqrt{x+a}$ $\sqrt{{e}^{ax}}$ ${e}^{\sqrt{x}}$ $a{e}^{-b{x}^{2}+c}$ $\frac{\mathrm{sin}\left(x\right)}{\mathrm{cos}\left(x\right)}$ $a{x}^{2}+bx+c$ ${e}^{x}\cdot \mathrm{sin}\left(x\right)\cdot \mathrm{cos}\left(x\right)$ $\frac{1}{\sqrt{ax}}$ $a{e}^{bx+c}$ ${e}^{ax}$ ${e}^{a{x}^{2}}$ $\frac{1}{{e}^{ax}}$ $\frac{x}{{e}^{x}}$ $\frac{1}{\mathrm{sin}}$ $\frac{1}{\mathrm{cos}}$ $\frac{1}{\mathrm{tan}}$ $a\cdot \mathrm{sin}\left(bx+c\right)$ $a\cdot \mathrm{cos}\left(bx+c\right)$ $a\cdot \mathrm{tan}\left(bx+c\right)$ $a\cdot {\mathrm{sin}}^{2}\left(bx+c\right)$

Notation: The function must be entered in the notation of the Javascript syntax.

Parameter: Three constants a, b and c are available, which can be changed by means of the sliders. The start point is shown by the black cross in the diagram and can be moved.

## Description of the Newton method

The aim of the Newton method is to find a zero of a generally non-linear function. That is to find a solution of the equation

$f\left(x\right)=0$

To achieve this, the function is linearized at a position x0 by replacing the function with its tangent. Thus, by a straight line equation which passes through the point (x0), the slope f '(x0).

The general form of the straight line equation is

$y=ax+b$

Conditions

$f\left({x}_{0}\right)=f\prime \left({x}_{0}\right){x}_{0}+b$

Dissolving after b

$b=f\left({x}_{0}\right)-f\prime \left({x}_{0}\right){x}_{0}$

Thus the straight line equation is completely determined

$y=f\prime \left({x}_{0}\right)x+f\left({x}_{0}\right)-f\prime \left({x}_{0}\right){x}_{0}=f\left({x}_{0}\right)+f\prime \left({x}_{0}\right)\left(x-{x}_{0}\right)$

The desired zero point of f is now replaced by the zero point of the straight line equation as the first approximation.

$0=f\left({x}_{0}\right)+f\prime \left({x}_{0}\right)\left(x-{x}_{0}\right)$

Resolving to x gives the first approximation for the zero point.

$x={x}_{0}-\frac{f\left({x}_{0}\right)}{f\prime \left({x}_{0}\right)}$

The iteration is to use this approximation as the starting point for the next approximation. The iteration process is then as follows:

${x}_{\mathrm{n+1}}={x}_{n}-\frac{f\left({x}_{n}\right)}{f\prime \left({x}_{n}\right)}$

with any starting value x0. Against which and if at all the Newton method converges depends sensitively on the choice of the starting value.

## Example for Newton's method

The example shows the iteration steps of the Newton method to find numerically the root of a quadratic function.

The example function is:

$f\left(x\right)={x}^{2}-x$

The derivative is:

$f\prime \left(x\right)=2x-1$

We use as start value:

${x}_{0}=3.5$

The first iteration step is:

${x}_{1}={x}_{0}-\frac{f\left({x}_{0}\right)}{f\prime \left({x}_{0}\right)}=3.5-\frac{8.75}{6.5}=2.04167$

The function value at the first iteration step is:

$f\left({x}_{1}\right)=2.12674$

$f\prime \left({x}_{1}\right)=3.08334$

So the second iteration step is:

${x}_{2}={x}_{1}-\frac{f\left({x}_{1}\right)}{f\prime \left({x}_{1}\right)}=2.04167-\frac{2.12674}{3.08334}=1.35192$

And so on for further iteration steps.

### Usable expressions in the definition of the function f(x)

Constants

NameDescription
LN2Natural logarithm of 2
LN10Natural logarithm of 10
LOG2EBase 2 logarithm of EULER
LOG10EBase 10 logarithm of EULER
PIRatio of the circumference of a circle to its diameter
SQRT1_2Square root of 1/2
SQRT2Square root of 2

Trigonometric Functions

FunctionDescription
sin(x)sine of x
cos(x)Cosine of x
tan(x)Tangent of x
asin(x)arcsine
acos(x)arccosine of x
atan(x)arctangent of x
atan2(y, x)Returns the arctangent of the quotient of its arguments.
cosh(x)Hyperbolic cosine of x
sinh(x)Hyperbolic sine of x

Logarithm and Exponential

FunctionDescription
pow(b, e)e to the b
sqrt(x)Square root of x
exp(x)EULER to the x
log(x), ln(x)Natural logarithm
log(x, b)Logarithm to base b
log2(x), lb(x)Logarithm to base 2
log10(x), ld(x)Logarithm to base 10

More functions

FunctionDescription
ceil(x)Get smallest integer n with n > x.
abs(x)Absolute value of x
max(a, b, c, ...)Maximum value of all given values.
min(a, b, c, ...)Minimum value of all given values.
random(max = 1)Generate a random number between 0 and max.
round(v)Returns the value of a number rounded to the nearest integer.
floor(x)Returns the biggest integer n with n < x.
factorial(n)Calculates n!
trunc(v, p = 0)Truncate v after the p-th decimal.
V(s)Returns the value of the given element, e.g. sliders and angles.

### Screenshot of the Image

Print or save the image via right mouse click.

## More Calculators

Here is a list of of further useful calculators and sites:

Index Regression Calculator NxN Cramer's rule Calculator NxN Gauss method Matrix Determinant Derivative calculus Partial derivatives and gradient Differential equations