Skip to main content

Newton–Raphson - Failure of the method to converge - example

The method does not converge , it means the approximation could not found

for certain equations like for ex 


y = 2 * x +2 * z +1 - b

here b is the value we need to find 

2 * x +2 * z +1 =  b


if we try the iteration method for this to find the value of x where the loss is zero

the cycle tends to repeat the same value for x alternatively .


finding dy/dx = 2 ,dy/dz =2 

x1 = x 0 - y(x0, z0)/ f '(x)

z1 = z 0 - y(x0, z0)/ f '(z) 

assume values for x0 = 0.5 , z0 = 0.4 , b = 24

y(0) = 2 *(0.5) +2 *(0.4) +1 - 24

 y0=-21.2


x1 = 0.5 - (-21.2 /2)

x1 = 11.1

z1 = 0.4 -  (-21.2 /2)

 z1 = 11


to check for convergence i wil substitute the value of x1 and z1 in the equation 

so that if it converges ,means  y =0 ,because iam expecting a value of 24 from the 

equation, lets see


y1 = 2(0.5) +2(11) +1 -24

y1= 21.2 


the loss here is too large not even close to zero.

ok we wil go for the next iteration and see

x2 = x1 - y1/f '(x1)

z2 = z1 - y1/f '(z1)

x2 = 11.1 - (21.2/2)

x2= 0.5

z2 = 11 - (21.2 /2)

z2 = 0.4

 

so whats this it looks like we have moved back to our initial guessed values for x ,z  

so the newton's method rotates and will not converge for this equation.

the reason why this is not used for machine learning convergence.


 

 

Comments

Popular posts from this blog

SHA-256 initial values

The simple workout to arrive at the initial values for sha-256 The first 32 bit of the fractional part of the sqroot (first 8 prime number 2-19) Alright what does it say  Sqrroot(prime)- Let’s say the first prime is 2 Sqroot(2)  = 1.414213562373095 Convert to hexadecimal- Since we are worried about the fractional part alone Converting the fractional part would be easy Fractional part- 0.414213562373095 Multiply the fractional part with 16 to arrive at hex 0.414213562373095*16= 6.62741699796952 0.62741699796952*16= 10.03867196751232 0.03867196751232*16=0.61875148019712 0.61875148019712*16=9.90002368315392 0.90002368315392*16=14.40037893046272 0.40037893046272*16=6.40606288740352 0.40606288740352*16=6.49700619845632 0.49700619845632*16=7.95209917530112 Resulting hexadecimal would be 6a09e667 which is  h0 := 0x6a09e667 Iam going to stop at the 8th iteration , why is that ? Since we are interested in 32 bit (8*4=32) Alright to make it clear  Convert hexade...

Linear Regression with one variable - Introduction

 It is not but making a some how clear relationship among variables the dependent and independent variables. talking in terms of maths the equation can be used meaningfully for something may be to determine /predict values from data. if y = m * x + b  the values for m , b can be anything but has to appropriate to predict y  so the loss which is  difference from existing to prediction is close to zero ~0 to start with we can say the one variable as -x  in some scenario m , b are called variables    the equation stated about is a line equation we have any equation  y = 2*x  y = x*x y = 2x +2x*x  so why the need of all these equations , it is all about playing data now a days in machine learning problems we create a data sets , lets consider as x  y to be a value of x the datas . y = datas  when we express the data as a function and plot in the graph we get the curves  take some random data x and plot x and y  x =1 , 2, ...

Auth0

You might be wondering what is this auth0  it is used for authentication of you applications  could be any apps  1.SPA - Angular , React  2.web app 3.Node  here we will talk about the node use case and go with example  moving ahead for now  if your are not familiar with node dont worry its a funny exercise for now walk with me  we dont have to worry too much for authentication as the service is  provided from auth0   create your node app  install node  https://nodejs.org/en/download/package-manager/  choose your os and do the installation once installed check for the version ' node -v  ' i assume u have installed so that u wil get the version for now  since iam using LINUX this will look like root@strings-desktop:/home/strings/js# node -v v16.13.0 moving on to creating node app for now    create a file app.js and paste the contents  app.js/ const http = require('http'); const express = require('ex...