Question

In: Advanced Math

Using matlab Find x and y that solve the following system: ln(x 2 + y) =...

Using matlab

Find x and y that solve the following system: ln(x 2 + y) = 1 − y , xy = − √ x

Solutions

Expert Solution


%Matlab code for Newton method
clear all
close all
syms x y
%functions for which intersection have to find
f(x,y) = log(x^2+y)+y-1;
g(x,y) = x*y+sqrt(x);

fprintf('Here we will going to use Newton method to find roots\n\n')
%Displaying the equation
fprintf('The equations are\n')
fprintf('\n\tf(x,y) = ')
disp(f)
fprintf('\n\tg(x,y) = ')
disp(g)
%creating Jacobian matrix
f_x(x,y)=diff(f,x);
f_y(x,y)=diff(f,y);
g_x(x,y)=diff(g,x);
g_y(x,y)=diff(g,y);
%Jacobian matrix
jac1=[f_x f_y; g_x g_y];

%displaying the Jacobian Matrix
fprintf('\tThe Jacobian Matrix is \n\n')
disp(vpa((jac1),2))
x1=5;y1=5;
fprintf('Newton method for initial guess x=%f and y=%f \n\n',x1,y1)
fprintf(' for x=%2.2f and y=%2.2f Jacobian matrix is \n',x1,y1)
disp([f_x(x1,y1) f_y(x1,y1);g_x(x1,y1) g_y(x1,y1)])

%loop for Newton iterations
  
    err=1;k=0;
    fprintf('For initial condition x=%f and y=%f \n',x1,y1)
    while err>10^-6
        k=k+1;
        jac=[f_x(x1,y1) f_y(x1,y1);g_x(x1,y1) g_y(x1,y1)];
        ijac=inv(jac);
        uu=double([x1;y1]-ijac*[f(x1,y1);g(x1,y1)]);
        err=norm(uu-[x1;y1]);
        x1=double(uu(1));
        y1=double(uu(2));
        fprintf('\nAfter %d iterations\n',k)
        fprintf('Value of x=%f\t Value for y=%f\n',x1,y1)
    end
  
    fprintf('\n\tThe root of equations using Newton method occured at x=%f, y=%f\n\n',x1,y1)


  
    %%%%%%%%%%%%%%%%%%%%%%End of Code %%%%%%%%%%%%%%%%%%%%%%%%%%%


Related Solutions

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 the following problems by using the Variation of Parameters y′′− 8y′+ 16y = e^4x ln(x)
Solve the following problems by using the Variation of Parameters y′′− 8y′+ 16y = e^4x ln(x)
Find an equation of the tangent to the curve x = 2 + ln t, y...
Find an equation of the tangent to the curve x = 2 + ln t, y = t2 + 4 at the point (2, 5) by two methods. (a) without eliminating the parameter (b) by first eliminating the parameter
use variation of parameters to solve y''+y'-2y=ln(x)
use variation of parameters to solve y''+y'-2y=ln(x)
Write your own MATLAB code to solve the system 10 − x + sin(x + y)...
Write your own MATLAB code to solve the system 10 − x + sin(x + y) − 1 = 0 8y − cos2 (z − y) − 1 = 0 12z + sin(z) − 1 = 0 using a residual tolerance of 10^−6 and the initial guess, ~x 0 = [0.1, 0.25, 0.08]^T . Print out the values for x, y and z for each iteration in a table similar to the one you created for the problems of the...
Solve by using power series: 2 y'−y = sinh( x). Find the recurrence relation and compute...
Solve by using power series: 2 y'−y = sinh( x). Find the recurrence relation and compute the first 6 coefficients (a0-a5). Use the methods of chapter 3 to solve the differential equation and show your chapter 8 solution is equivalent to your chapter 3 solution.
Solve (1+e^x)dy/dx+(e^x)y=3x^2+1 Solve (x^3+y^3)dx+3xy^2 dy = 0 Solve (y-cos y)dx + (xsiny+x)dy = 0 Solve (1+ln...
Solve (1+e^x)dy/dx+(e^x)y=3x^2+1 Solve (x^3+y^3)dx+3xy^2 dy = 0 Solve (y-cos y)dx + (xsiny+x)dy = 0 Solve (1+ln x +y/x)dx = (1-lnx)dy Solve (y^2+yx)dx - x^2dy =0 Solve (x^2+2y^2)dx = xydy Solve Bernoulli's Equation x dy/dx + 2y = (x^4)(e^x)(y^2) Solve Bernoulli's Equation (1+x^2) dy/dx = 2xy +(e^x)(y^2) Solve IVP (3e^(x^2))dy + (xy^2)dx=0 ; y(1) = 2 Solve IVP dy/dx -2xy = e^(x^2) ; y(0)=0 Solve IVP (x^2+y^2)dx+(2xy)dy=0; y(1)=1 6. Mixture Problem Initially 40 lb of salt is dissolved in a large...
solve using both methods (Dsolve and ODE45 on matlab) please provide steps 1) y'+y=e^x 2) y'+2y=...
solve using both methods (Dsolve and ODE45 on matlab) please provide steps 1) y'+y=e^x 2) y'+2y= 2 sin(x)
Solve this differential equation using Matlab yy' + xy2 =x , with y(0)=5 for x=0 to...
Solve this differential equation using Matlab yy' + xy2 =x , with y(0)=5 for x=0 to 2.5 with a step size 0.25 (a) Analytical (b) Euler (c) Heun d) 4th order R-K method Display all results on the same graph
1. Differentiate the following functions A. y=ln(x+sqrt(x^2 -1)) B. y=ln(sinx) C. y=xlnx-x D. y=e^x(sinx)
1. Differentiate the following functions A. y=ln(x+sqrt(x^2 -1)) B. y=ln(sinx) C. y=xlnx-x D. y=e^x(sinx)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT