Bro please solve Q 3.10 in Matlab i only need the final answer just capture it t
ID: 3110505 • Letter: B
Question
Bro please solve Q 3.10 in Matlab i only need the final answer just capture it the screen
Many thanks
Evaluate the error and compare with part (a). Calculate the random access memory (RAM) in megabytes necessary to store a multidimensional array that is 20 times 40 times 120. This array is double precision, and each value requires a 64-bit word. Recall that a 64-bit word = 8 bytes and 1 kilobyte = 2^10 bytes. Assume that the index starts at 1. Determine the number of terms necessary to approximate cos x to 8 significant figures using the Maclaurin series approximation cos x = 1 - x^2/2 + x^4/4! - x^6/6! + x^8/8! - .... Calculate the approximation using a value of x = 0.3 pi. Write a program to determine your result.Explanation / Answer
Solution:
n = 8; %Significant Digits
x = .3*pi;
epsilon_s = (.5*10^(2-n));
Res(1,1) = 1;
Res(2,1) = 1 - x^2/2;
Res(3,1) = 1 - x^2/2 + x^4/factorial(4);
Res(4,1) = 1 - x^2/2 + x^4/factorial(4) - x^6/factorial(6);
Res(5,1) = 1 - x^2/2 + x^4/factorial(4) - x^6/factorial(6) + x^8/factorial(8);
Res(6,1) = 1 - x^2/2 + x^4/factorial(4) - x^6/factorial(6) + x^8/factorial(8) -x^10/factorial(10);
Res(7,1) = 1 - x^2/2 + x^4/factorial(4) - x^6/factorial(6) + x^8/factorial(8) -x^10/factorial(10) + x^12/factorial(12);
for i = 1:6
Res(i,2) = (Res(i+1,1) - Res(i,1))/Res(i+1,1);
Res(i,3) = Res(i,2) - epsilon_s;
end
disp(' maclaurin_i e_i e_i-e_s')
disp(Res)
for j = 1:6
if abs(Res(j,2)) < epsilon_s
disp('Error is OK for i ='); disp(j)
end
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.