It has to be done on matlab (a) The equation, + x sin(x)-exp(x) 5 = 0 , has one
ID: 2262265 • Letter: I
Question
It has to be done on matlab(a) The equation, + x sin(x)-exp(x) 5 = 0 , has one positive solution and one negative solution. Suppose that the original equation is rearranged into the form, x =g(x), and Fixed-point iterative method is used to seek the solutions. Moreover, a constraint is imposed that the initial guess, xo-4, will be used to seek the positive solution, and 3 wl be used to seek the negative solution. Given this constraint, find an appropriate choice of g(x) for each case (that targets the positive or negative solution) such that the process of iteration converges to the desired solution. Perform 100 iterations for each choice of (Xo. g(x)) and take the result at the end of 100 iterations as the solution. To summarize, the key task of this exercise is to fill the question marks in following table: Given initial guess, o Choice of g(x) thatSolution after 100 (cannot be changed) eads to convergence iterations Case Target: positive solution Target: negative solution (b) Is it possible to start from the initial guess, xo3, and use Fixed-point iterative method to find the positive solution for this problem? If "yes", provide an example of g(x) that leads to convergence to the positive solution. If "no", explain why. (If the correct answer is "no", a valid explanation is required to receive full credit.)
Explanation / Answer
Solution (a): The MATLAB code for obtaining positive and negative solution is:
clc, clear all
i=1;
x(1)=4;
y(1)=-3;
for i=1:100
x(i+1)=log((x(i)^3)+(x(i)*sin(x(i)))+5);
y(i+1)=nthroot(exp(y(i))-y(i)*sin(y(i))-5,3);
i=i+1;
end
fprintf('The positive root after 100 iterations is %d ',x(100))
fprintf('The negative root after 100 iterations is %d ',y(100))
Output:
The negative root after 100 iterations is 4.552151e+00
The positive root after 100 iterations is -1.879362e+00
The table using the convergency criteria |g'(x)|<1, is as given below:
Case Given initial guess, x0 Choice of g(x) that leads to convergence Solution after 100 iterations Target: Positive solution 4 g(x)=ln(x3+x sin(x)+5) 4.552 Target: Negative solution -3 g(x)=(ex-x sin(x)-5)1/3 -1.879Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.