Problem 415. Sum the Infinite Series
Given that 0 < x and x < 2*pi where x is in radians, write a function
[c,s] = infinite_series(x);
that returns with the sums of the two infinite series
c = cos(2*x)/1/2 + cos(3*x)/2/3 + cos(4*x)/3/4 + ... + cos((n+1)*x)/n/(n+1) + ... s = sin(2*x)/1/2 + sin(3*x)/2/3 + sin(4*x)/3/4 + ... + sin((n+1)*x)/n/(n+1) + ...
Solution Stats
Problem Comments
-
5 Comments
It is possible to obtain the results for this series using Wolfram Alpha or Symbolic Math Toolbox. It is not a pretty result, but the series converges. Unless you are up to hard work, there is no point in finding this simplification manually. And the Taylor Series does not help.
Interesting, getting rough estimate is easy, but without further derivations, being close is hard.
Could this oscillatory behavior be dampened by filtering it for example?
I wasted a lot of hours trying to look at these summations as a discrete Fourier transform. (I work in ocean acoustics, so it was natural.) Quick way to get an approximation, however!
Next, I worked out closed forms for multiples of pi/2, but found no enlightenment. And pi/4 multiples got weird, especially on the cosine side.
And contrary to what Rafael S.T. Vieira posted about two years ago, Taylor series was the key to arriving at my solution. I didn't use Wolfram Alpha or Symbolic Toolbox, but I did use the table of integrals in the back of my CRC Handbook of Chemistry and Physics. (Physics major with computer science option (minor) here!). Actually, the integrals I used are also listed in this significantly more modest table: https://www.integral-table.com/.
Solution Comments
Show commentsGroup

Sequences & Series I
- 14 Problems
- 87 Finishers
- Sum all integers from 1 to 2^n
- Integer sequence - 2 : Kolakoski sequence
- Sum all integers from 1 to 2^n
- Project Euler: Problem 2, Sum of even Fibonacci
- Sum of first n terms of a harmonic progression
- Project Euler: Problem 6, Natural numbers, squares and sums.
- Integer Sequence - II : New Fibonacci
- Project Euler: Problem 2, Sum of even Fibonacci
- Project Euler: Problem 6, Natural numbers, squares and sums.
- Find the stride of the longest skip sequence
- Sum the Infinite Series
- Return the Fibonacci Sequence
- Sum of first n terms of a harmonic progression
- "Look and say" sequence
- Is X a Fibonacci Matrix?
- Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
- Golomb's self-describing sequence (based on Euler 341)
- Alternating sum
- Integer sequence - 2 : Kolakoski sequence
- Integer Sequence - II : New Fibonacci
Problem Recent Solvers132
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!