Cody

Solution 1985385

Submitted on 22 Oct 2019 by Asif Newaz
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; y_correct = -0.858407346410207; assert(abs(pi_approx(n)-y_correct)<(100*eps))

a = 1 b = 4 y = -0.8584

2   Pass
n = 2; y_correct = 0.474925986923126; assert(abs(pi_approx(n)-y_correct)<(100*eps))

a = 1 a = 0.6667 b = 2.6667 y = 0.4749

3   Pass
n = 4; y_correct = 0.246354558351698; assert(abs(pi_approx(n)-y_correct)<(100*eps))

a = 1 a = 1.2000 a = 0.8667 a = 0.7238 b = 2.8952 y = 0.2464

4   Pass
n = 7; y_correct = -0.142145830148691; assert(abs(pi_approx(n)-y_correct)<(100*eps))

a = 1 a = 1.2000 a = 1.3111 a = 1.3880 a = 1.0547 a = 0.9118 a = 0.8209 b = 3.2837 y = -0.1421

5   Pass
n = 10; y_correct = 0.099753034660390; assert(abs(pi_approx(n)-y_correct)<(100*eps))

a = 1 a = 1.2000 a = 1.3111 a = 1.3880 a = 1.4469 a = 1.1135 a = 0.9707 a = 0.8798 a = 0.8131 a = 0.7605 b = 3.0418 y = 0.0998

6   Pass
n = 14; y_correct = 0.071338035810608; assert(abs(pi_approx(n)-y_correct)<(100*eps))

a = 1 a = 1.2000 a = 1.3111 a = 1.3880 a = 1.4469 a = 1.4945 a = 1.5345 a = 1.2011 a = 1.0583 a = 0.9674 a = 0.9007 a = 0.8481 a = 0.8046 a = 0.7676 b = 3.0703 y = 0.0713

7   Pass
n = 17; y_correct = -0.058772861819756; assert(abs(pi_approx(n)-y_correct)<(100*eps))

a = 1 a = 1.2000 a = 1.3111 a = 1.3880 a = 1.4469 a = 1.4945 a = 1.5345 a = 1.5690 a = 1.5993 a = 1.2659 a = 1.1231 a = 1.0322 a = 0.9655 a = 0.9129 a = 0.8694 a = 0.8323 a = 0.8001 b = 3.2004 y = -0.0588

8   Pass
n = 20; y_correct = 0.049968846921953; assert(abs(pi_approx(n)-y_correct)<(100*eps))

a = 1 a = 1.2000 a = 1.3111 a = 1.3880 a = 1.4469 a = 1.4945 a = 1.5345 a = 1.5690 a = 1.5993 a = 1.6263 a = 1.2930 a = 1.1501 a = 1.0592 a = 0.9925 a = 0.9399 a = 0.8964 a = 0.8594 a = 0.8271 a = 0.7985 a = 0.7729 b = 3.0916 y = 0.0500

9   Pass
n = 25; y_correct = -0.039984031845239; assert(abs(pi_approx(n)-y_correct)<(100*eps))

a = 1 a = 1.2000 a = 1.3111 a = 1.3880 a = 1.4469 a = 1.4945 a = 1.5345 a = 1.5690 a = 1.5993 a = 1.6263 a = 1.6507 a = 1.6729 a = 1.6933 a = 1.3600 a = 1.2171 a = 1.1262 a = 1.0595 a = 1.0069 a = 0.9634 a = 0.9264 a = 0.8941 a = 0.8656 a = 0.8399 a = 0.8167 a = 0.7954 b = 3.1816 y = -0.0400