Cody

Solution 2023361

Submitted on 15 Nov 2019 at 16:32 by Le Duc Vu
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))

estimated_pi = 0 estimated_pi = 4 y = -0.858407346410207

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

estimated_pi = 0 estimated_pi = 4 estimated_pi = 2.666666666666667 y = 0.474925986923126

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

estimated_pi = 0 estimated_pi = 4 estimated_pi = 2.666666666666667 estimated_pi = 3.466666666666667 estimated_pi = 2.895238095238096 y = 0.246354558351698

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

estimated_pi = 0 estimated_pi = 4 estimated_pi = 2.666666666666667 estimated_pi = 3.466666666666667 estimated_pi = 2.895238095238096 estimated_pi = 3.339682539682540 estimated_pi = 2.976046176046176 estimated_pi = 3.283738483738484 y = -0.142145830148691

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

estimated_pi = 0 estimated_pi = 4 estimated_pi = 2.666666666666667 estimated_pi = 3.466666666666667 estimated_pi = 2.895238095238096 estimated_pi = 3.339682539682540 estimated_pi = 2.976046176046176 estimated_pi = 3.283738483738484 estimated_pi = 3.017071817071818 estimated_pi = 3.252365934718877 estimated_pi = 3.041839618929403 y = 0.099753034660390

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

estimated_pi = 0 estimated_pi = 4 estimated_pi = 2.666666666666667 estimated_pi = 3.466666666666667 estimated_pi = 2.895238095238096 estimated_pi = 3.339682539682540 estimated_pi = 2.976046176046176 estimated_pi = 3.283738483738484 estimated_pi = 3.017071817071818 estimated_pi = 3.252365934718877 estimated_pi = 3.041839618929403 estimated_pi = 3.232315809405594 estimated_pi = 3.058402765927333 estimated_pi = 3.218402765927333 estimated_pi = 3.070254617779185 y = 0.071338035810608

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

estimated_pi = 0 estimated_pi = 4 estimated_pi = 2.666666666666667 estimated_pi = 3.466666666666667 estimated_pi = 2.895238095238096 estimated_pi = 3.339682539682540 estimated_pi = 2.976046176046176 estimated_pi = 3.283738483738484 estimated_pi = 3.017071817071818 estimated_pi = 3.252365934718877 estimated_pi = 3.041839618929403 estimated_pi = 3.232315809405594 estimated_pi = 3.058402765927333 estimated_pi = 3.218402765927333 estimated_pi = 3.070254617779185 estimated_pi = 3.208185652261944 estimated_pi = 3.079153394197428 estimated_pi = 3.200365515409549 y = -0.058772861819756

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

estimated_pi = 0 estimated_pi = 4 estimated_pi = 2.666666666666667 estimated_pi = 3.466666666666667 estimated_pi = 2.895238095238096 estimated_pi = 3.339682539682540 estimated_pi = 2.976046176046176 estimated_pi = 3.283738483738484 estimated_pi = 3.017071817071818 estimated_pi = 3.252365934718877 estimated_pi = 3.041839618929403 estimated_pi = 3.232315809405594 estimated_pi = 3.058402765927333 estimated_pi = 3.218402765927333 estimated_pi = 3.070254617779185 estimated_pi = 3.208185652261944 estimated_pi = 3.079153394197428 estimated_pi = 3.200365515409549 estimated_pi = 3.086079801123835 estimated_pi = 3.194187909231943 estimated_pi = 3.091623806667840 y = 0.049968846921953

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

estimated_pi = 0 estimated_pi = 4 estimated_pi = 2.666666666666667 estimated_pi = 3.466666666666667 estimated_pi = 2.895238095238096 estimated_pi = 3.339682539682540 estimated_pi = 2.976046176046176 estimated_pi = 3.283738483738484 estimated_pi = 3.017071817071818 estimated_pi = 3.252365934718877 estimated_pi = 3.041839618929403 estimated_pi = 3.232315809405594 estimated_pi = 3.058402765927333 estimated_pi = 3.218402765927333 estimated_pi = 3.070254617779185 estimated_pi = 3.208185652261944 estimated_pi = 3.079153394197428 estimated_pi = 3.200365515409549 estimated_pi = 3.086079801123835 estimated_pi = 3.194187909231943 estimated_pi = 3.091623806667840 estimated_pi = 3.189184782277596 estimated_pi = 3.096161526463642 estimated_pi = 3.185050415352531 estimated_pi = 3.099944032373808 estimated_pi = 3.181576685435032 y = -0.039984031845239