B
B
BigLebovski2019-01-07 19:03:30
C++ / C#
BigLebovski, 2019-01-07 19:03:30

Write a program that calculates the sum of a series with an EPS error?

An infinite series of the form cos(x*k)/k is given, where x is specified by the user, and k is the number of the current term, while EPS=10^(-2). For example, for x=2, the series will take the form: cos(2*1)/1 + cos(2*2)/2 + cos(2*3)/3 + .... etc. I can't figure out what type of series (convergent\divergent) and what role EPS plays. Or is it the precision of the sum to hundredths, or is it the maximum required difference between the current and the previous member of the sequence for the summation to stop?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sumor, 2019-01-07
@BigLebovski

It is obvious that for x = 2*PI the series diverges.
Most likely, it can be proved that it diverges for any x, possibly except for some singular points.
For example, if x = 2*PI/q, where q is any rational number, q=m/n, where m is an integer, n is a natural number. Then the range of the function cos(x*k) is finite, with power at most n. Then you can take the minimum value from the range and take it out of the brackets; then a series will remain in brackets, which is limited from below by a harmonic series that diverges.
From here, you just have to count the partial sum of the series until the difference between the elements becomes less than EPS. By the way, finding elements whose difference is less than EPS does not guarantee that you will not exceed this threshold in the following terms. Perhaps it makes sense for EPS to limit the corresponding terms of the harmonic series.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question