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

Write a code using MATLAB for the following #\'s Is + 1/2^4 + 1/3^4 1/4^4 + ...

ID: 3825894 • Letter: W

Question

Write a code using MATLAB for the following #'s

Is + 1/2^4 + 1/3^4 1/4^4 + ... + 1/N^4 = 1/N^4 + ... + 1/3^4 + 1/2^4 + 1? Consider the infinite series sigma_i = 1^infinity 1/i^4, this series converges and it converges to pi^4/90. One can try to approximate the infinite series by only adding a finite number of terms, and if the number of terms is large enough, then we could expect to have a good approximation. Compute the partial sums S_N = sigma_i = 1^N 1/i^4 = 1 + 1/2^4 + 1/3^4 + 1/4^4 + ... + 1/N^4 and the errors in the partial sums given by E_N = Exact - S_N (here Exact is pi^4/90). Let N at least reach 20, 000. Present your results in graphical form. Now compute the partial sums, but in the opposite direction (S_N = 1/N^4 + ... + 1/3^4 + 1/2^4 + 1). Again, compute the errors in the partial sums. Present your results in graphical form. Compare the results from parts 1) and 2).

Explanation / Answer

N = 2000;

SUMF = 0;

SUMR = 0;

Exact = (pi.^4)/90;

for i=1:1:N

SUMF = SUMF + i.^(-4);

end;

ENF = Exact -SUMF;

f = fprintf('SUM OF SERIES : %f ERROR IS : %f',SUMF,ENF);

disp(f);

for i=1:1:N

SUMR = SUMR + i.^(-4);

end;

f1 = fprintf('SUM OF SERIES IN OPPOSITE DIRECTION : %f ERROR IS : %f',SUMR,ENR);

disp(f1);

plot(SUMF,'*b');

hold on;

plot(SUMR,'rO');

ENR = Exact - SUMR;

if( SUMF == SUMR)

disp('Equal Value')

else

disp('Not Equal Value')

end;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote