Cody

Solution 1890979

Submitted on 3 Aug 2019
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))

x = 1 s = 1 y = -0.8584

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

x = 1 -1 s = 1 3 y = -0.8584 4.4749

Error using assert The condition input argument must be a scalar logical. Error in Test2 (line 3) assert(abs(pi_approx(n)-y_correct)<(100*eps))

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

x = 1 -1 1 -1 s = 1 3 5 7 y = -0.8584 4.4749 2.3416 3.7130

Error using assert The condition input argument must be a scalar logical. Error in Test3 (line 3) assert(abs(pi_approx(n)-y_correct)<(100*eps))

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

x = 1 -1 1 -1 1 -1 1 s = 1 3 5 7 9 11 13 y = -0.8584 4.4749 2.3416 3.7130 2.6971 3.5052 2.8339

Error using assert The condition input argument must be a scalar logical. Error in Test4 (line 3) assert(abs(pi_approx(n)-y_correct)<(100*eps))

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

x = 1 -1 1 -1 1 -1 1 -1 1 -1 s = 1 3 5 7 9 11 13 15 17 19 y = -0.8584 4.4749 2.3416 3.7130 2.6971 3.5052 2.8339 3.4083 2.9063 3.3521

Error using assert The condition input argument must be a scalar logical. Error in Test5 (line 3) assert(abs(pi_approx(n)-y_correct)<(100*eps))

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

x = 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 s = 1 3 5 7 9 11 13 15 17 19 21 23 25 27 y = -0.8584 4.4749 2.3416 3.7130 2.6971 3.5052 2.8339 3.4083 2.9063 3.3521 2.9511 3.3155 2.9816 3.2897

Error using assert The condition input argument must be a scalar logical. Error in Test6 (line 3) assert(abs(pi_approx(n)-y_correct)<(100*eps))

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

x = 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 s = 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 y = -0.8584 4.4749 2.3416 3.7130 2.6971 3.5052 2.8339 3.4083 2.9063 3.3521 2.9511 3.3155 2.9816 3.2897 3.0037 3.2706 3.0204

Error using assert The condition input argument must be a scalar logical. Error in Test7 (line 3) assert(abs(pi_approx(n)-y_correct)<(100*eps))

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

x = 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 s = 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 y = Columns 1 through 18 -0.8584 4.4749 2.3416 3.7130 2.6971 3.5052 2.8339 3.4083 2.9063 3.3521 2.9511 3.3155 2.9816 3.2897 3.0037 3.2706 3.0204 3.2559 Columns 19 through 20 3.0335 3.2442

Error using assert The condition input argument must be a scalar logical. Error in Test8 (line 3) assert(abs(pi_approx(n)-y_correct)<(100*eps))

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

x = 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 s = 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 y = Columns 1 through 18 -0.8584 4.4749 2.3416 3.7130 2.6971 3.5052 2.8339 3.4083 2.9063 3.3521 2.9511 3.3155 2.9816 3.2897 3.0037 3.2706 3.0204 3.2559 Columns 19 through 25 3.0335 3.2442 3.0440 3.2346 3.0527 3.2267 3.0600

Error using assert The condition input argument must be a scalar logical. Error in Test9 (line 3) assert(abs(pi_approx(n)-y_correct)<(100*eps))