The question is the following: Use Newton’s method to solve $$x^3_1+x_2=1,\\ x^3_2−x_1=−1 $$ Indicate your initial condition and how many steps it requires to reach the tolerate of error to be within 10−6 .
I can generate the code for just one equation. I don't know how to do it for both equations. This is my code for one of them
% Change here for different functions
f=@(x) x^(3)+x-1
%this is the derivative of the above function
df=@(x) 3*x^(2)+1
% Change lower limit 'a' and upper limit 'b'
a=0; b=1;
x=a;
for i=1:1:100
x1=x-(f(x)/df(x));
x=x1;
end
sol=x;
fprintf('Approximate Root is %.15f',sol)
a=0;b=1;
x=a;
er(5)=0;
for i=1:1:5
x1=x-(f(x)/df(x));
x=x1;
er(i)=x1-sol;
end
plot(er)
xlabel('Number of iterations')
ylabel('Error')
title('Error Vs. Number of iterations')
Your function is
$$\mathbf{f}(\mathbf{x}) = \begin{pmatrix} x_1^3+x_2 \\ -x_1 + x_2^3 \end{pmatrix}.$$
Compute its Jacobian. Solve
$$\mathbf{x}_{n+1} = \mathbf{x}_n - \mathbf{J}^{-1}(\mathbf{x}_{n})\mathbf{x}_n.$$
You can write the function in MATLAB syntax as
The Jacobian I will leave to you.