Question: USE MATLAB TO COMPLETE THIS PROBLEM! The harmonic series, sigma^infinity_k = 1 1/k = 1 + 1/2 + 1/3 + 1/4 + is known to
USE MATLAB TO COMPLETE THIS PROBLEM!

The harmonic series, sigma^infinity_k = 1 1/k = 1 + 1/2 + 1/3 + 1/4 + is known to diverge to +infinity. The nth partial sum approaches +infinity at the same rate as log(n). (a) Euler's constant is defined to be gamma = lim_n rightarrow infinity [sigma^n_k = 1 (1/k) - log(n)] almostequalto 0.57721. Write and test a section in your script that calculates the first 5000 partial sums (that is calculate each partial sum for n = 1 to 5000) and estimates Euler's constant using Eq. (I). Write your routine so that each value is calculated, but values are only stored every 250 steps. (b) Euler's constant, gamma, can also be represented by gamma = lim_n rightarrow infinity [sigma^n_k = 1 (1/k) - log (n + 1/2)] almostequalto 0.57721. Write and test a section in your script that estimates Euler's constant when n = 5000 using Eq. (II). Print intermediate answers at every 250 steps. (c) Display your results in a table with columns n, values from part(a) and values from part(b). Label the columns and make the display easy to read. Based on your outputs, which of the two codes converges more rapidly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
