Cody

Solution 2037198

Submitted on 27 Nov 2019 by Monika Krejci
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))

f = 1 f1 = 1 e = 4 y = -0.8584

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

f = 1 f1 = 1 f = -0.3333 f1 = 0.6667 e = 2.6667 y = 0.4749

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

f = 1 f1 = 1 f = -0.3333 f1 = 0.6667 f = 0.2000 f1 = 0.8667 f = -0.1429 f1 = 0.7238 e = 2.8952 y = 0.2464

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

f = 1 f1 = 1 f = -0.3333 f1 = 0.6667 f = 0.2000 f1 = 0.8667 f = -0.1429 f1 = 0.7238 f = 0.1111 f1 = 0.8349 f = -0.0909 f1 = 0.7440 f = 0.0769 f1 = 0.8209 e = 3.2837 y = -0.1421

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

f = 1 f1 = 1 f = -0.3333 f1 = 0.6667 f = 0.2000 f1 = 0.8667 f = -0.1429 f1 = 0.7238 f = 0.1111 f1 = 0.8349 f = -0.0909 f1 = 0.7440 f = 0.0769 f1 = 0.8209 f = -0.0667 f1 = 0.7543 f = 0.0588 f1 = 0.8131 f = -0.0526 f1 = 0.7605 e = 3.0418 y = 0.0998

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

f = 1 f1 = 1 f = -0.3333 f1 = 0.6667 f = 0.2000 f1 = 0.8667 f = -0.1429 f1 = 0.7238 f = 0.1111 f1 = 0.8349 f = -0.0909 f1 = 0.7440 f = 0.0769 f1 = 0.8209 f = -0.0667 f1 = 0.7543 f = 0.0588 f1 = 0.8131 f = -0.0526 f1 = 0.7605 f = 0.0476 f1 = 0.8081 f = -0.0435 f1 = 0.7646 f = 0.0400 f1 = 0.8046 f = -0.0370 f1 = 0.7676 e = 3.0703 y = 0.0713

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

f = 1 f1 = 1 f = -0.3333 f1 = 0.6667 f = 0.2000 f1 = 0.8667 f = -0.1429 f1 = 0.7238 f = 0.1111 f1 = 0.8349 f = -0.0909 f1 = 0.7440 f = 0.0769 f1 = 0.8209 f = -0.0667 f1 = 0.7543 f = 0.0588 f1 = 0.8131 f = -0.0526 f1 = 0.7605 f = 0.0476 f1 = 0.8081 f = -0.0435 f1 = 0.7646 f = 0.0400 f1 = 0.8046 f = -0.0370 f1 = 0.7676 f = 0.0345 f1 = 0.8020 f = -0.0323 f1 = 0.7698 f = 0.0303 f1 = 0.8001 e = 3.2004 y = -0.0588

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

f = 1 f1 = 1 f = -0.3333 f1 = 0.6667 f = 0.2000 f1 = 0.8667 f = -0.1429 f1 = 0.7238 f = 0.1111 f1 = 0.8349 f = -0.0909 f1 = 0.7440 f = 0.0769 f1 = 0.8209 f = -0.0667 f1 = 0.7543 f = 0.0588 f1 = 0.8131 f = -0.0526 f1 = 0.7605 f = 0.0476 f1 = 0.8081 f = -0.0435 f1 = 0.7646 f = 0.0400 f1 = 0.8046 f = -0.0370 f1 = 0.7676 f = 0.0345 f1 = 0.8020 f = -0.0323 f1 = 0.7698 f = 0.0303 f1 = 0.8001 f = -0.0286 f1 = 0.7715 f = 0.0270 f1 = 0.7985 f = -0.0256 f1 = 0.7729 e = 3.0916 y = 0.0500

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

f = 1 f1 = 1 f = -0.3333 f1 = 0.6667 f = 0.2000 f1 = 0.8667 f = -0.1429 f1 = 0.7238 f = 0.1111 f1 = 0.8349 f = -0.0909 f1 = 0.7440 f = 0.0769 f1 = 0.8209 f = -0.0667 f1 = 0.7543 f = 0.0588 f1 = 0.8131 f = -0.0526 f1 = 0.7605 f = 0.0476 f1 = 0.8081 f = -0.0435 f1 = 0.7646 f = 0.0400 f1 = 0.8046 f = -0.0370 f1 = 0.7676 f = 0.0345 f1 = 0.8020 f = -0.0323 f1 = 0.7698 f = 0.0303 f1 = 0.8001 f = -0.0286 f1 = 0.7715 f = 0.0270 f1 = 0.7985 f = -0.0256 f1 = 0.7729 f = 0.0244 f1 = 0.7973 f = -0.0233 f1 = 0.7740 f = 0.0222 f1 = 0.7963 f = -0.0213 f1 = 0.7750 f = 0.0204 f1 = 0.7954 e = 3.1816 y = -0.0400

Suggested Problems

More from this Author139