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

Exercise 4 The number can be defined as a limit of various converging series of

ID: 3877498 • Letter: E

Question

Exercise 4 The number can be defined as a limit of various converging series of numbers. Among them "; 16E(8k4+1-824-8k +5-8k+6) tsli Simon Plouffe (1995), (4) k-0 Euler (1735). k-1 Write a Matlab/Octave function pi series.m retuns the first 10 partial sums of the series (4)-(5), i.e., the vectors P and E with components n+1 16k8k +1 8k +4 8k +5 8k +6 k-0 n. k-1 The function should be of the following form function [P,E,n1,n2]=pi-series() Output P, E: row vectors with 10 components defined by the first 10 partial sums in (6) and (7). n1, n2: see the Extra Credit exercise hereafter. If you do not want to code the extra credit part just set n1-0 and n2-0 in the function pi series.m. Extra Credit: At the end of the Matlab function pi series.m, write a code that returns the smallest integer numbers ni and n2 such that IE,,-

Explanation / Answer

function [P,E,n1,n2]=pi_series()
    for n=0:9   %for first 10 sums n=0 to 9
        sum=0; %initially sum is 0
        for k=0:n %for k=0 to n
            sum=sum+(1/16^k)*(4/(8*k+4)-2/(8*k+4)-1/(8*k+5)-1/(8*k+6));
        end
        P(n+1)=sum; %each time sum is sent to vector P
    end
  
    for n=1:10 % for first 10 sums n=1 to 10
        sum=0; %initially sum is 0
        for k=1:n %for k=1 to n
            sum=sum+sqrt((1/k^2));
        end
        E(n)=(sqrt(6))*sum; %each sum is sent to vector E
    end
  
    n1=0;
    n2=0;
  
    disp(P);
    disp(E);
end

output:--

>> pi_series
    0.1333    0.1345    0.1345    0.1345    0.1345    0.1345    0.1345    0.1345    0.1345    0.1345

    2.4495    3.6742    4.4907    5.1031    5.5930    6.0012    6.3512    6.6574    6.9295    7.1745