Question

In: Advanced Math

Use Matlab to solve the system x2+xy3=9 , 3x2y-y3 =4 using Newton's method for nonlinear system....

Use Matlab to solve the system x2+xy3=9 , 3x2y-y3 =4 using Newton's method for nonlinear system. use each of initial guesses (x0,y0)=(1.2,2.5), (-2,2.5), (-1.2,-2.5), (2,-2.5) observe which root to which the method converges, the number of iterates required and the speed of convergence.

Write the system in the form f(u) = 0, and report for each case the number of iterations needed for ||f(u)||2≤ 10-12−.

Solutions

Expert Solution

clc;
clear all;

%intial condition
x=1.2;
y=2.5;

%tolerence
tol=1e-12;
err=0.5;
%%%Initial points save in x1and x2 for print purpose
x1(1)=x;
x2(1)=y;
n=2;
while(err>tol)
%functio F
f1= x.^2+x.*y.^3-9;
f2=3*x.^2.*y-y.^3-4 ;
  
  
%%% partial derivatives of F (linearization)
f11=2*x+y.^3;
f12=3*y.^2.*x;


f21=6*x.*y;
f22=3*x.^2-3*y.^2;


J=[f11 f12 ; f21 f22 ]; %jacobian matrix
J1=inv(J);
Z=[x ;y]-J1*[f1; f2]; % newton formula
err=norm([f1; f2],2);
x=Z(1);
y=Z(2);

% %%% Every iteration values save in x1 and x2 for print
x1(n)=x;
x2(n)=y;
n=n+1;

end
n
disp('____________________________________________________________________')
disp('iteration x1 x2 ')
disp('____________________________________________________________________')
for i=1:n-1
  
fprintf('%d\t %15f \t %15f \n',i,x1(i),x2(i))
end
disp( 'Intersection point')
[x,y]
disp('Number of iterations with initial condition (1.2, 2.5)')
n-1

clc;
clear all;

%intial condition
x=-2;
y=2.5;

%tolerence
tol=1e-12;
err=0.5;
%%%Initial points save in x1and x2 for print purpose
x1(1)=x;
x2(1)=y;
n=2;
while(err>tol)
%functio F
f1= x.^2+x.*y.^3-9;
f2=3*x.^2.*y-y.^3-4 ;
  
  
%%% partial derivatives of F (linearization)
f11=2*x+y.^3;
f12=3*y.^2.*x;


f21=6*x.*y;
f22=3*x.^2-3*y.^2;


J=[f11 f12 ; f21 f22 ]; %jacobian matrix
J1=inv(J);
Z=[x ;y]-J1*[f1; f2]; % newton formula
err=norm([f1; f2],2);
x=Z(1);
y=Z(2);

% %%% Every iteration values save in x1 and x2 for print
x1(n)=x;
x2(n)=y;
n=n+1;

end

disp('____________________________________________________________________')
disp('iteration x y ')
disp('____________________________________________________________________')
for i=1:n-1
  
fprintf('%d\t %15f \t %15f \n',i,x1(i),x2(i))
end
disp( 'Intersection point')
[x,y]
disp('Number of iterations with initial condition (-2, 2.5)')
n-1

%%%%%%%%%%%%%%%%%%%% Answer

____________________________________________________________________
iteration x y   
____________________________________________________________________
1   -2.000000    2.500000
2   -1.473397    1.696580
3   -1.179337    0.639062
4   -3.195436    -1.913207
5   -1.742641    -1.795509
6   -0.971947    -1.974885
7   -0.895735    -2.089564
8   -0.901263    -2.086579
9   -0.901266    -2.086588
10   -0.901266    -2.086588
11   -0.901266    -2.086588
Intersection point

ans =

-0.9013 -2.0866

Number of iterations with initial condition (-2, 2.5)

ans =

11

>>

clc;
clear all;

%intial condition
x=-1.2;
y=-2.5;

%tolerence
tol=1e-12;
err=0.5;
%%%Initial points save in x1and x2 for print purpose
x1(1)=x;
x2(1)=y;
n=2;
while(err>tol)
%functio F
f1= x.^2+x.*y.^3-9;
f2=3*x.^2.*y-y.^3-4 ;
  
  
%%% partial derivatives of F (linearization)
f11=2*x+y.^3;
f12=3*y.^2.*x;


f21=6*x.*y;
f22=3*x.^2-3*y.^2;


J=[f11 f12 ; f21 f22 ]; %jacobian matrix
J1=inv(J);
Z=[x ;y]-J1*[f1; f2]; % newton formula
err=norm([f1; f2],2);
x=Z(1);
y=Z(2);

% %%% Every iteration values save in x1 and x2 for print
x1(n)=x;
x2(n)=y;
n=n+1;

end

disp('____________________________________________________________________')
disp('iteration x y ')
disp('____________________________________________________________________')
for i=1:n-1
  
fprintf('%d\t %15f \t %15f \n',i,x1(i),x2(i))
end
disp( 'Intersection point')
[x,y]
disp('Number of iterations with initial condition (-1.2, -2.5)')
n-1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Answer

____________________________________________________________________
iteration x y   
____________________________________________________________________
1   -1.200000    -2.500000
2   -0.985132    -2.174800
3   -0.908497    -2.091489
4   -0.901311    -2.086601
5   -0.901266    -2.086588
6   -0.901266    -2.086588
7   -0.901266    -2.086588
Intersection point

ans =

-0.9013 -2.0866

Number of iterations with initial condition (-1.2, -2.5)

ans =

7

>>

clc;
clear all;

%intial condition
x=2;
y=-2.5;

%tolerence
tol=1e-12;
err=0.5;
%%%Initial points save in x1and x2 for print purpose
x1(1)=x;
x2(1)=y;
n=2;
while(err>tol)
%functio F
f1= x.^2+x.*y.^3-9;
f2=3*x.^2.*y-y.^3-4 ;
  
  
%%% partial derivatives of F (linearization)
f11=2*x+y.^3;
f12=3*y.^2.*x;


f21=6*x.*y;
f22=3*x.^2-3*y.^2;


J=[f11 f12 ; f21 f22 ]; %jacobian matrix
J1=inv(J);
Z=[x ;y]-J1*[f1; f2]; % newton formula
err=norm([f1; f2],2);
x=Z(1);
y=Z(2);

% %%% Every iteration values save in x1 and x2 for print
x1(n)=x;
x2(n)=y;
n=n+1;

end

disp('____________________________________________________________________')
disp('iteration x y ')
disp('____________________________________________________________________')
for i=1:n-1
  
fprintf('%d\t %15f \t %15f \n',i,x1(i),x2(i))
end
disp( 'Intersection point')
[x,y]
disp('Number of iterations with initial condition (2, -2.5)')
n-1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

____________________________________________________________________
iteration x y   
____________________________________________________________________
1   2.000000    -2.500000
2   1.224118    -1.773857
3   0.352397    -0.769761
4   -22.175315    22.599350
5   -14.832213    17.565361
6   -10.202207    13.543333
7   -7.190606    10.367504
8   -5.168467    7.889394
9   -3.772849    5.973114
10   -2.789209    4.495752
11   -2.085083    3.345040
12   -1.572499    2.407123
13   -1.186599    1.518463
14   -0.939118    0.121361
15   -5.272400    0.397125
16   -3.491379    0.316557
17   -3.029761    0.192941
18   -3.001248    0.148966
19   -3.001625    0.148108
20   -3.001625    0.148108
21   -3.001625    0.148108
Intersection point

ans =

-3.0016 0.1481

Number of iterations with initial condition (2, -2.5)

ans =

21

>>


Related Solutions

use newton raphson method to solve the following system of nonlinear equations x1^2+x2^2=50 ; x1*x2=25 stop...
use newton raphson method to solve the following system of nonlinear equations x1^2+x2^2=50 ; x1*x2=25 stop after three iterations. initial guess : (x1,x2) = (2,1)
Solve using matlab code!! Use the graphical method to solve 4x1 − 8x2 = −24 x1...
Solve using matlab code!! Use the graphical method to solve 4x1 − 8x2 = −24 x1 + 6x2 = 34 Check your results by substituting them back into the equations.(include this on the code)
Use MATLAB to solve graphically the planar system of linear equations x +4 y = −4...
Use MATLAB to solve graphically the planar system of linear equations x +4 y = −4 4x +3 y =4 to an accuracy of two decimal points. Hint: The MATLAB command zoom on allows us to view the plot in a window whose axes are one-half those of original. Each time you click with the mouse on a point, the axes’ limits are halved and centered at the designated point. Coupling zoom on with grid on allows you to determine...
Solve Kepler's Equations Using Euler's Method in matlab.
Solve Kepler's Equations Using Euler's Method in matlab.
Write a program using Newton's method: Use your programs to find approximations to within 10^(-4) to...
Write a program using Newton's method: Use your programs to find approximations to within 10^(-4) to all zeros of the following cubic polynomials. Use |P_(n+1)-P_n| as a measure of the error in the iteration. Save all of the iterations. What are your conclusions? (a) f(x) = x^3-5x^2 + 2x (b) f(x) = x^3-2x^2-5 The program has to be used with MATLAB. I'm still learning how to use the program. I would love some help and tips on solving these methods....
Write a MATLAB code for the conjugate gradient method and apply it to solve the system...
Write a MATLAB code for the conjugate gradient method and apply it to solve the system Hx = b, where H is the n×n Hilbert matrix, and b is A times the vector of all ones, for (a) n = 4; (b) n = 8. Compare your numerical solutions with the exact solution (which is the vector of all ones), and report your numerical errors.
Using Matlab 1. Solve the following equations set f1 (x1,x2) = sin (sin (x1)) +x2 f2...
Using Matlab 1. Solve the following equations set f1 (x1,x2) = sin (sin (x1)) +x2 f2 (x1,x2) = x1+ e^(x2) a) Can this equation set be solved by the fixed - point method with the following expressions? And why? Show your analysis with a 2D graph. g1 (x1,x2) = -e^(x2) g2 (x1,x2) = -sin⁡(x1) b) Use Newton Raphson Method with initial values x1 = -2, x2 = 1.5. (8 significant figures. Please submit the code and results.)
Matlab Consider f(x) = x^3 - x. Plot it. (a) Use Newton's method with p_0 =1.5...
Matlab Consider f(x) = x^3 - x. Plot it. (a) Use Newton's method with p_0 =1.5 to find an approximation to a root with tolerance TOL = 0.01. (b) Use secant method with p_0 = 0.5 , p_1 =1.5, to answer same question as (a). (c) Use Method of False position with initial approximate roots as in (b).
Solve the following equations using the Newton-Raphason method. ( using matlab) x^2+x*y^2 = 9 ?3x^2 *...
Solve the following equations using the Newton-Raphason method. ( using matlab) x^2+x*y^2 = 9 ?3x^2 * y - y^3 = 4    ?initial estimation of (x,y) = (1.2, 2.5) ?please help.. using matlab and matlab code
Solve for the unknown x and y in the following nonlinear equation using Taylor’s theorem (Use...
Solve for the unknown x and y in the following nonlinear equation using Taylor’s theorem (Use ?0 = 5 and ?0 = 5 for initial approximations) ?^2? − 3?^2 = 75 ?^2 − ? = 19
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT