Cody

Solution 1925308

Submitted on 7 Sep 2019 by Doan Quang Manh
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))

p = 1 y = -0.858407346410207

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

p = 1 p = 0.666666666666667 y = 0.474925986923126

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

p = 1 p = 0.666666666666667 p = 0.866666666666667 p = 0.723809523809524 y = 0.246354558351698

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

p = 1 p = 0.666666666666667 p = 0.866666666666667 p = 0.723809523809524 p = 0.834920634920635 p = 0.744011544011544 p = 0.820934620934621 y = -0.142145830148691

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

p = 1 p = 0.666666666666667 p = 0.866666666666667 p = 0.723809523809524 p = 0.834920634920635 p = 0.744011544011544 p = 0.820934620934621 p = 0.754267954267954 p = 0.813091483679719 p = 0.760459904732351 y = 0.099753034660390

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

p = 1 p = 0.666666666666667 p = 0.866666666666667 p = 0.723809523809524 p = 0.834920634920635 p = 0.744011544011544 p = 0.820934620934621 p = 0.754267954267954 p = 0.813091483679719 p = 0.760459904732351 p = 0.808078952351398 p = 0.764600691481833 p = 0.804600691481833 p = 0.767563654444796 y = 0.071338035810608

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

p = 1 p = 0.666666666666667 p = 0.866666666666667 p = 0.723809523809524 p = 0.834920634920635 p = 0.744011544011544 p = 0.820934620934621 p = 0.754267954267954 p = 0.813091483679719 p = 0.760459904732351 p = 0.808078952351398 p = 0.764600691481833 p = 0.804600691481833 p = 0.767563654444796 p = 0.802046413065486 p = 0.769788348549357 p = 0.800091378852387 y = -0.058772861819756

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

p = 1 p = 0.666666666666667 p = 0.866666666666667 p = 0.723809523809524 p = 0.834920634920635 p = 0.744011544011544 p = 0.820934620934621 p = 0.754267954267954 p = 0.813091483679719 p = 0.760459904732351 p = 0.808078952351398 p = 0.764600691481833 p = 0.804600691481833 p = 0.767563654444796 p = 0.802046413065486 p = 0.769788348549357 p = 0.800091378852387 p = 0.771519950280959 p = 0.798546977307986 p = 0.772905951666960 y = 0.049968846921953

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

p = 1 p = 0.666666666666667 p = 0.866666666666667 p = 0.723809523809524 p = 0.834920634920635 p = 0.744011544011544 p = 0.820934620934621 p = 0.754267954267954 p = 0.813091483679719 p = 0.760459904732351 p = 0.808078952351398 p = 0.764600691481833 p = 0.804600691481833 p = 0.767563654444796 p = 0.802046413065486 p = 0.769788348549357 p = 0.800091378852387 p = 0.771519950280959 p = 0.798546977307986 p = 0.772905951666960 p = 0.797296195569399 p = 0.774040381615911 p = 0.796262603838133 p = 0.774986008093452 p = 0.795394171358758 y = -0.039984031845239