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

1. Somebody claims that square root of 10 can be calculated by the following alg

ID: 2255698 • Letter: 1

Question

1. Somebody claims that square root of 10 can be calculated by the following algorithm: a. Set initial value: x,3 b. Find by this equation: = 10 Xo 2x, 2 c. Update the value of x, by using: . new_.ola d. repeat steps ‘b, and using the updated Xo until If the condition in step ‘d' is met. final Xp is the answer. e. To find out whether this proposed method is true or not, write a code in MATLAHB based on the above algorithm to find square root of 10. Determine how many iterations are needed for this purpose. .

Explanation / Answer

%%%Matlab code %%%

clc;
clear all;
close all;
format long

x(1)=3;
for n=1:1000
e=10/2/x(n)-x(n)/2;
x(n+1)=x(n)+e;
t=abs(x(n+1)-x(n))/x(n);
if (t<10^(-6));
break;
end
end
fprintf(' 10^0.5 = %f and number of step required is %d ',x(end),n);

OUTPUT:

10^0.5 = 3.162278 and number of step required is 3