Problem 420. Sum the Infinite Series II
Solution Stats
Problem Comments
-
9 Comments
A nice problem. But the singularity provides a domain where a variable loss of precision is observed. Several formulae, which are mathematicaly equivalent and computationaly careful, give distinct results. Guessing the one that was used is the second step of the problem, and maybe the most difficult.
The answer for the third test case seems to be a little off.
i agree; my solution on the third and fifth test cases are showing up as incorrect even though I'm using an analytical form of the solution for this problem.
agree, I am getting 182.574870487881 and 306.940139754640 for the third and fifth cases, respectively; I guess we are supposed to find a way to better approximate around the singularity (for the x~=2*pi*n cases)?
I no longer take issue with test case 5, but I'm finding that it does not take care of test case 3.
Results for case 3 (x=6.28318) from Mathematica, a typical Matlab closed-form solution, and the test suite are
306.9401397617041 Mathematica
306.9401397549153 Matlab
306.9401397805991 test suite
The result near 2*pi is a function of the difference between the input and 2*pi; since 6.28318 is equal to 2*pi to 6 digits, when you subtract 2*pi from it
you lose 6 digits of accuracy; the error tolerance should be set to about 10^6*eps to be fair for this case.
This is not peculiar to this function--here are results for sin(6.28318) from
Mathematica and Matlab:
-5.307179586452011e-6 Mathematica
-5.307179586686775e-6 Matlab
Again you lose about 6 digits of accuracy in Matlab.
i agree
I have a closed form for the series and I'm having problems with test case 3...It seems that I joined the club...
There seems to be agreement that test case 3 has issues. Since the original author never returned, I commented out that test case.
Solution Comments
Show commentsProblem Recent Solvers19
Suggested Problems
-
Similar Triangles - find the height of the tree
299 Solvers
-
Number of 1s in a binary string
9055 Solvers
-
Determine Whether an array is empty
774 Solvers
-
5035 Solvers
-
170 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!