Question

# For each equation, write a brief program to compute and print eight steps of Newton's method...

For each equation, write a brief program to compute and print eight steps of Newton's method for finding a positive root (Preferably in Matlab or Python).

a. x=2sinx

b. x^3=sinx+7

c. sinx=1-x

d. x^5+x^2=1+7x^3 for x>=2

A)

clc

clear all

x(1)=1;

iter(1)=0;

for i=1:7

f(i)= x(i)-2*sin(x(i));

der_f(i)=1-2*cos(x(i));

x(i+1)=x(i)-f(i)/der_f(i);

iter(i+1)=iter(i)+1;

end;

fprintf("%i %f", iter, x);

B)

clc

clear all

x(1)=1;

iter(1)=0;

for i=1:7

f(i)= x(i).^3-sin(x(i))-7;

der_f(i)=3*x(i).^2-cos(x(i));

x(i+1)=x(i)-f(i)/der_f(i);

iter(i+1)=iter(i)+1;

end;

fprintf("%i %f", iter, x);

C).

clc

clear all

x(1)=1;

iter(1)=0;

for i=1:7

f(i)= sin(x(i))-1-x(i);

der_f(i)=cos(x(i))-1;

x(i+1)=x(i)-f(i)/der_f(i);

iter(i+1)=iter(i)+1;

end;

fprintf("%i %f", iter, x);

D).

clc

clear all

x(1)=2;

iter(1)=0;

for i=1:7

f(i)= x(i).^5+x(i).^2-1-7*x(i).^3;

der_f(i)=5*x(i).^4+2*x(i)-21*x(i).^2

x(i+1)=x(i)-f(i)/der_f(i);

iter(i+1)=iter(i)+1;

end;

fprintf("%i %f", iter, x);

#### Earn Coins

Coins can be redeemed for fabulous gifts.