Problem 415. Sum the Infinite Series
Solution Stats
Problem Comments

5 Comments
So what would the Cody size of a bruteforce algorithm be for this problem?
I got the correct answers within 50*eps for all answers except x=0.001 for c. Is c_correct value correct for x=0.001? I put in a small correction factor 1.5e14 to get your c_correct value.
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.integraltable.com/.
Solution Comments

2 Comments
this one is truely a wonderfun code! make my eyes open.
Mr Castanon is a true god. I preferred asking wolfram solver.
Wish I studied infinite series properly at school

2 Comments
Yes, you are right S L, a direct brute force summation is surely not the most efficient method of determining the sums of these series. You are the only one so far with a valid solution that met the 50*eps tests. In fact your answers are very much closer than that to mine, within a few eps. However, there is another single analytic function that can be used which is much simpler and would undoubtedly give you a lower "size" than 92 if you or others can find it. R. Stafford
thanks for the hint
Problem Recent Solvers114
Suggested Problems

Determine whether a vector is monotonically increasing
16351 Solvers

Which values occur exactly three times?
4504 Solvers

2206 Solvers

978 Solvers

829 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!