How do I solve a nonlinear function with Newton-Raphson assuming that my variable is discrete?

38 Views Asked by At

Let's say I want to approximate $\sqrt 2$.

I, therefore, write my function $$ f(x) = x^2-2 = 0 $$

I define $x$ to be a discrete variable which can take values $\color{brown}{0, 0.1, 0.2, 0.3, 0.4, 0.5}$, etc.

Is there a Newton-Raphson method for solving this?

Kindly also explain the solution procedure by working out the problem.

Regards.

3

There are 3 best solutions below

1
On

Solve the equation with infinitely small step interval using Newton-Raphson etc. and choose the root making smaller residue with finite interval.

If step is $h=0.1$ then

$$|(1.4^2 - 2)|< ( 1.5^2 - 2)|, $$

and so the nearest root is $x=1.4$;

2
On

The derivative of $f(x)$ is $f'(x)=2x$.

Let $x_0=0.1$.

step 1: $x_1=x_0-\frac{f(x_0)}{f'(x_0)}=0.1-\frac{-1.99}{0.2}=10.05$

step 2: $x_2=x_1-\frac{f(x_1)}{f'(x_1)}=10.05-\frac{99.0025}{20.1}\approx5.1245$

step 3: $x_3=x_2-\frac{f(x_2)}{f'(x_2)}=5.1245-\frac{24.2605}{10.249}\approx2.75739$

step 4: $x_4=x_3-\frac{f(x_3)}{f'(x_3)}=2.75739-\frac{5.6032}{5.51478}\approx1.74136$

step 5: $x_5=x_4-\frac{f(x_4)}{f'(x_4)}=1.74136-\frac{1.03233}{3.48272}\approx1.44494$

step 6: $x_6=x_5-\frac{f(x_5)}{f'(x_5)}=1.44494-\frac{0.0878516}{2.88988}\approx1.41454$

step 7: $x_7=x_6-\frac{f(x_6)}{f'(x_6)}=1.41454-\frac{0.000923412}{2.82908}\approx1.41421$

step 8: $x_8=x_7-\frac{f(x_7)}{f'(x_7)}=1.41421-\frac{-0.0000100759}{2.82842}\approx1.41421$

Therefore $x\approx 1.41421$.

0
On

This is a way to approximate without knowing that $1.4 \approx \sqrt{2}$.

If we plug $1,2$ into $f(x)$, we'd get

$$ f(1) < f(2) \\ -1 < 2$$

So for $1 < x_0 < 2$, $f(x_0) = 0$. So, choose $x_0 = \frac{1+2}{2}=1.5$. From here, you can approximate it normally (as shown by other answers).

Of course, you can take $1.1, 1.9$ and get a better $x_0$, but this is just a (very) crude way to choose an initial guess.