For each part create a vector n in which the first element is 1, the increment is 1 and the last term is 5, 50, or 5,000. Then use element-by-element calculations to create a vector in which the elements are 1 n 2 1n2. Finally, use MATLAB’s built-in function sum to sum the series. Compare the values to π2 / 6. Use format long to display the numbers.

Respuesta :

Answer:

a = 1:5

b = 1:50

c = 1:5000

Explanation: the file script will be.

format long

% Part (a) n=1:5;

an=1./n.^2;

Sa=sum(an)

pi_sq_ov6=pi^2/6

% Part (b) n=1:50;

an=1./n.^2;

Sb=sum(an)

pi_sq_ov6=pi^2/6

% Part (c)

n=1:5000;

an=1./n.^2;

Sc=sum(an)

pi_sq_ov6=pi^2/6

Finding each values in the above, the command window will have the following values.

Command Window:

Sa = 1.463611111111111

pi_sq_ov6 = 1.644934066848226

Sb = 1.625132733621529

pi_sq_ov6 =1.644934066848226

Sc = 1.644734086846901

pi_sq_ov6 = 1.644934066848226