Cody

Solution 1941122

Submitted on 18 Sep 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   Fail
n = 1:5; y_correct = [-0.858407346410207 0.474925986923126 -0.325074013076874 0.246354558351698 -0.198089886092747]; answers = pi_approx(n); for i = 1:numel(n) assert(abs(answers(i)-y_correct(i))<(100*eps)) end

y = -0.858407346410207 y = -0.858407346410207 4.474925986923126 y = -0.858407346410207 4.474925986923126 2.341592653589793 y = -0.858407346410207 4.474925986923126 2.341592653589793 3.713021225018364 y = -0.858407346410207 4.474925986923126 2.341592653589793 3.713021225018364 2.697148209145348

Assertion failed.

2   Fail
n = 2:2:10; y_correct = [0.474925986923126 0.246354558351698 0.165546477543617 0.124520836517975 0.099753034660390]; answers = pi_approx(n); for i = 1:numel(n) assert(abs(answers(i)-y_correct(i))<(100*eps)) end

y = 4.474925986923126 y = 4.474925986923126 2.341592653589793 y = 4.474925986923126 2.341592653589793 3.713021225018364 y = 4.474925986923126 2.341592653589793 3.713021225018364 2.697148209145348 y = 4.474925986923126 2.341592653589793 3.713021225018364 2.697148209145348 3.505229017226157 y = 4.474925986923126 2.341592653589793 3.713021225018364 2.697148209145348 3.505229017226157 2.833900345897486 y = 4.474925986923126 2.341592653589793 3.713021225018364 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 y = 4.474925986923126 2.341592653589793 3.713021225018364 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 y = 4.474925986923126 2.341592653589793 3.713021225018364 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267

Assertion failed.

3   Fail
n = 5:5:25; y_correct = [-0.198089886092747 0.099753034660390 -0.066592998672151 0.049968846921953 -0.039984031845239]; answers = pi_approx(n); for i = 1:numel(n) assert(abs(answers(i)-y_correct(i))<(100*eps)) end

y = 2.697148209145348 y = 2.697148209145348 3.505229017226157 y = 2.697148209145348 3.505229017226157 2.833900345897486 y = 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 y = 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 y = 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 y = 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 y = 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 y = 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Column 10 3.289740801737941 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 11 3.289740801737941 3.003661619107035 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 12 3.289740801737941 3.003661619107035 3.270624911654309 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 13 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 14 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 15 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 3.033484545481685 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 16 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 3.033484545481685 3.244156756153896 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 17 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 3.033484545481685 3.244156756153896 3.044031677980037 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 18 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 18 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 Column 19 3.052703764700904 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 18 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 Columns 19 through 20 3.052703764700904 3.226699036568517 y = Columns 1 through 9 2.697148209145348 3.505229017226157 2.833900345897486 3.408259320256460 2.906298535942734 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 Columns 10 through 18 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 Columns 19 through 21 3.052703764700904 3.226699036568517 3.059960000528569

Assertion failed.

4   Fail
n = 10:10:100; y_correct = [0.099753034660390 0.049968846921953 0.033324086890846 0.024996096795960 0.019998000998782 0.016665509660796 0.014284985608559 0.012499511814072 0.011110768228485 0.009999750031239]; answers = pi_approx(n); for i = 1:numel(n) assert(abs(answers(i)-y_correct(i))<(100*eps)) end

y = 3.352118969379267 y = 3.352118969379267 2.951116463113602 y = 3.352118969379267 2.951116463113602 3.315505697068054 y = 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 y = 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 y = 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 y = 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 y = 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 y = 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Column 10 3.033484545481685 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 11 3.033484545481685 3.244156756153896 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 12 3.033484545481685 3.244156756153896 3.044031677980037 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 13 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 14 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 15 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 16 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 17 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Column 19 3.214319926317066 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Columns 19 through 20 3.214319926317066 3.071417214993302 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Columns 19 through 21 3.214319926317066 3.071417214993302 3.209389263759284 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Columns 19 through 22 3.214319926317066 3.071417214993302 3.209389263759284 3.076018883097990 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Columns 19 through 23 3.214319926317066 3.071417214993302 3.209389263759284 3.076018883097990 3.205084717081856 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Columns 19 through 24 3.214319926317066 3.071417214993302 3.209389263759284 3.076018883097990 3.205084717081856 3.080054192051332 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Columns 19 through 25 3.214319926317066 3.071417214993302 3.209389263759284 3.076018883097990 3.205084717081856 3.080054192051332 3.201294146127107 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Columns 19 through 26 3.214319926317066 3.071417214993302 3.209389263759284 3.076018883097990 3.205084717081856 3.080054192051332 3.201294146127107 3.083621639097040 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Columns 19 through 27 3.214319926317066 3.071417214993302 3.209389263759284 3.076018883097990 3.205084717081856 3.080054192051332 3.201294146127107 3.083621639097040 3.197930681758807 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Columns 19 through 27 3.214319926317066 3.071417214993302 3.209389263759284 3.076018883097990 3.205084717081856 3.080054192051332 3.201294146127107 3.083621639097040 3.197930681758807 Column 28 3.086798133041848 y = Columns 1 through 9 3.352118969379267 2.951116463113602 3.315505697068054 2.981592653589793 3.289740801737941 3.003661619107035 3.270624911654309 3.020380532377672 3.255878367875507 Columns 10 through 18 3.033484545481685 3.244156756153896 3.044031677980037 3.234615909403747 3.052703764700904 3.226699036568517 3.059960000528569 3.220024026138813 3.066120955476586 Columns 19 through 27 ...

Assertion failed.