Cody

# Problem 45939. Estimate π from certain values of the zeta function

Solution 2688131

Submitted on 13 Jul 2020 by ChrisR
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 = 30; m = 2; y_correct = '1.00e-02'; assert(isequal(PiByZeta(n,m),y_correct))

2   Pass
n = 30; m = 8; y_correct = '7.22e-13'; assert(isequal(PiByZeta(n,m),y_correct))

3   Pass
n = 1; m = 20; y_correct = '4.77e-08'; assert(isequal(PiByZeta(n,m),y_correct))

4   Pass
n = 5:5:30; m = 2; y_correct = '5.67e-02 2.94e-02 1.98e-02 1.49e-02 1.20e-02 1.00e-02'; assert(isequal(PiByZeta(n,m),y_correct))

5   Pass
n = 10; m = 2:2:10; y_correct = ['2.94e-02'; '6.62e-05'; '2.54e-07'; '1.24e-09'; '6.92e-12']; assert(isequal(PiByZeta(n,m),y_correct))

6   Pass
n = [25 30]; m = [2 8]; y_correct = ['1.20e-02 1.00e-02'; '2.53e-12 7.22e-13']; assert(isequal(PiByZeta(n,m),y_correct))

7   Pass
n = 1:5; m = 2:2:10; y_correct = ['2.20e-01 1.28e-01 9.04e-02 6.97e-02 5.67e-02'; ... '1.96e-02 4.61e-03 1.73e-03 8.26e-04 4.56e-04'; ... '2.86e-03 2.82e-04 5.67e-05 1.67e-05 6.25e-06'; ... '5.09e-04 2.13e-05 2.33e-06 4.27e-07 1.09e-07'; ... '9.94e-05 1.80e-06 1.08e-07 1.24e-08 2.14e-09']; assert(isequal(PiByZeta(n,m),y_correct))

### Community Treasure Hunt

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

Start Hunting!