By applying the Newton Raphson technique solve the following
By applying the Newton Raphson technique, solve the following non linear
expressions in order to determine the values of x and y up to a tolerance of
0.001. Do not iterate more than 4 times.
Solution
clc
clear;
itr=0;
tol=10;
x=1;y=1;
while ( itr<4 && tol>=0.001),
itr=itr+1;
f1=2*x^2+y^2-8;
f2=6*x+2*y^2-5;
dfd=[4*x 2*y;6 4*y];
df=[f1;f2];
d=inv(dfd)*df;
x=x+d(1);
y=y+d(2);
tol=max(abs(d));
end
if tol>=0.0001,
disp(\'not conversing by this newton method \');
disp(\'tolerence after 4 iterations\');
disp(tol);
else
disp(\'tol\');
disp(tol);
disp(\'ieration\')
disp(\'itr\');
disp(\'x=\');
disp(x);
disp(\'y=\');
disp(y);
end
result:
not conversing by this newton method
tolerence after 4 iterations
11.9617
