Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Construct a system of 4 nonlinear equations using the combination of sin(x), cos

ID: 3732791 • Letter: C

Question

Construct a system of 4 nonlinear equations using the combination of sin(x), cos(x). Xi, Xi3, exp(%), i = 1,2,3,4. The equation format looks like the following: 8 fi(x)-sin(x) + 2x22-X3X42 + X4 = 0. You can use any combinations, but try to be relatively simple. Then, you will have the following system of 4 nonlinear equations: fi(x) 0 2(x) 0, Or in vector format: F(x) 0. Write a matlab program that in each step, you need to solve a system of linear equations for the increment, write a subroutine to solve this linear system using the LU decomposition with pivoting plus forward and backward scheme. In the main program, you will repeatedly call the subroutine of the linear systems to move forward

Explanation / Answer

%LU descompotition is a method to solve linear equations,
%You need another method like newthon's method to solve nonlinear system equations.
%The easy way is next:

%Create symbolic variables x1 ,x2, x3 and x4
syms x1 x2 x3 x4;

%We create a 4 nonlinear equations following the format
f1= sin(x1)+2*x2^2-x3*x4^2+x1 == 0;
f2= cos(x2)+2*x1^2-x2*x3^2-x2 == 0;
f3= sin(x3)+2*x3^2-x3*x2^2+x3 == 0;
f4= cos(x4)+2*x4^2-x4*x1^2-x4 == 0;

%We solve the system (using solve or vpasolve function)
sol = solve(f1, f2, f3, f4);
%We print all results
solX1 = sol.x1
solX2 = sol.x2
solX3 = sol.x3
solX4 = sol.x4