Cody

Problem 2581. Sum of series VII

Solution 3199206

Submitted on 13 Oct 2020 by ivan fernandez
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
n = 1; m = 1; s_correct = 1/2; assert(isequal(sumOfSeriesVII(n,m),s_correct))

sum = 0 sum = 0.5000 s = 0.5000

2   Pass
n = 1; m = 2; s_correct = 1/3; assert(abs(sumOfSeriesVII(n,m)-s_correct)<eps)

sum = 0 sum = 0.3333 s = 0.3333

3   Pass
n = 3; m = 3; s_correct = 0.3875; assert(abs(sumOfSeriesVII(n,m)-s_correct)<eps)

sum = 0 sum = 0.1250 sum = 0.2750 sum = 0.3875 s = 0.3875

4   Pass
n = 4; m = 2; s_correct = 0.955555555555556; assert(abs(sumOfSeriesVII(n,m)-s_correct)<10*eps)

sum = 0 sum = 0.3333 sum = 0.6667 sum = 0.8667 sum = 0.9556 s = 0.9556

5   Pass
n = 7; m = 5; s_correct = 0.0408511683468281; assert(abs(sumOfSeriesVII(n,m)-s_correct)<10*eps)

sum = 0 sum = 0.0069 sum = 0.0169 sum = 0.0262 sum = 0.0331 sum = 0.0374 sum = 0.0397 sum = 0.0409 s = 0.0409

6   Pass
n = 5; m = 7; s_correct = 0.00114327593060232; assert(abs(sumOfSeriesVII(n,m)-s_correct)<10*eps)

sum = 0 sum = 1.7361e-04 sum = 4.4367e-04 sum = 7.2724e-04 sum = 9.6784e-04 sum = 0.0011 s = 0.0011

7   Pass
n = 10; m = 3; s_correct = 0.499971551885614; assert(abs(sumOfSeriesVII(n,m)-s_correct)<10*eps)

sum = 0 sum = 0.1250 sum = 0.2750 sum = 0.3875 sum = 0.4518 sum = 0.4819 sum = 0.4940 sum = 0.4982 sum = 0.4995 sum = 0.4999 sum = 0.5000 s = 0.5000

8   Pass
n = 14; m = 4; s_correct = 0.166666498956709; assert(abs(sumOfSeriesVII(n,m)-s_correct)<10*eps)

sum = 0 sum = 0.0333 sum = 0.0778 sum = 0.1159 sum = 0.1413 sum = 0.1554 sum = 0.1622 sum = 0.1650 sum = 0.1661 sum = 0.1665 sum = 0.1666 sum = 0.1667 sum = 0.1667 sum = 0.1667 sum = 0.1667 s = 0.1667

9   Pass
n = 15; m = 11; s_correct = 2.75459255461393e-07; assert(abs(sumOfSeriesVII(n,m)-s_correct)<10*eps)

sum = 0 sum = 2.2964e-08 sum = 6.1827e-08 sum = 1.0763e-07 sum = 1.5241e-07 sum = 1.9090e-07 sum = 2.2079e-07 sum = 2.4209e-07 sum = 2.5619e-07 sum = 2.6491e-07 sum = 2.6999e-07 sum = 2.7278e-07 sum = 2.7424e-07 sum = 2.7496e-07 sum = 2.7530e-07 sum = 2.7546e-07 s = 2.7546e-07

Suggested Problems

More from this Author9

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!