Cody

Solution 1863439

Submitted on 2 Jul 2019 by Vadim Smirnov
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
x = 10; y_correct = 3.041840000000000; assert(isequal(pi_est1(x),y_correct))

c = 0 y = 1 c = 1 y = -0.333333333333333 c = 0.666666666666667 y = 0.200000000000000 c = 0.866666666666667 y = -0.142857142857143 c = 0.723809523809524 y = 0.111111111111111 c = 0.834920634920635 y = -0.090909090909091 c = 0.744011544011544 y = 0.076923076923077 c = 0.820934620934621 y = -0.066666666666667 c = 0.754267954267954 y = 0.058823529411765 c = 0.813091483679719 y = -0.052631578947368 c = 0.760459904732351

2   Pass
x = 1000; y_correct = 3.140593000000000; assert(isequal(pi_est1(x),y_correct))

c = 0 y = 1 c = 1 y = -0.333333333333333 c = 0.666666666666667 y = 0.200000000000000 c = 0.866666666666667 y = -0.142857142857143 c = 0.723809523809524 y = 0.111111111111111 c = 0.834920634920635 y = -0.090909090909091 c = 0.744011544011544 y = 0.076923076923077 c = 0.820934620934621 y = -0.066666666666667 c = 0.754267954267954 y = 0.058823529411765 c = 0.813091483679719 y = -0.052631578947368 c = 0.760459904732351 y = 0.047619047619048 c = 0.808078952351398 y = -0.043478260869565 c = 0.764600691481833 y = 0.040000000000000 c = 0.804600691481833 y = -0.037037037037037 c = 0.767563654444796 y = 0.034482758620690 c = 0.802046413065486 y = -0.032258064516129 c = 0.769788348549357 y = 0.030303030303030 c = 0.800091378852387 y = -0.028571428571429 c = 0.771519950280959 y = 0.027027027027027 c = 0.798546977307986 y = -0.025641025641026 c = 0.772905951666960 y = 0.024390243902439 c = 0.797296195569399 y = -0.023255813953488 c = 0.774040381615911 y = 0.022222222222222 c = 0.796262603838133 y = -0.021276595744681 c = 0.774986008093452 y = 0.020408163265306 c = 0.795394171358758 y = -0.019607843137255 c = 0.775786328221503 y = 0.018867924528302 c = 0.794654252749805 y = -0.018181818181818 c = 0.776472434567987 y = 0.017543859649123 c = 0.794016294217110 y = -0.016949152542373 c = 0.777067141674737 y = 0.016393442622951 c = 0.793460584297688 y = -0.015873015873016 c = 0.777587568424672 y = 0.015384615384615 c = 0.792972183809287 y = -0.014925373134328 c = 0.778046810674959 y = 0.014492753623188 c = 0.792539564298147 y = -0.014084507042254 c = 0.778455057255894 y = 0.013698630136986 c = 0.792153687392880 y = -0.013333333333333 c = 0.778820354059547 y = 0.012987012987013 c = 0.791807367046560 y = -0.012658227848101 c = 0.779149139198458 y = 0.012345679012346 c = 0.791494818210804 y = -0.012048192771084 c = 0.779446625439720 y = 0.011764705882353 c = 0.791211331322072 y = -0.011494252873563 c = 0.779717078448509 y = 0.011235955056180 c = 0.790953033504689 y = -0.010989010989011 c = 0.779964022515678 y = 0.010752688172043 c = 0.790716710687721 y = -0.010526315789474 c = 0.780190394898247 y = 0.010309278350515 c = 0.790499673248763 y = -0.010101010101010 c = 0.780398663147753 y = 0.009900990099010 c = 0.790299653246763 y = -0.009708737864078 c = 0.780590915382685 y = 0.009523809523810 c = 0.790114724906494 y = -0.009345794392523 c = 0.780768930513971 y = 0.009174311926606 c = 0.789943242440577 y = -0.009009009009009 c = 0.780934233431568 y = 0.008849557522124 c = 0.789783790953691 y = -0.008695652173913 c = 0.781088138779778 y = 0.008547008547009 c = 0.789635147326787 y = -0.008403361344538 c = 0.781231785982249 y = 0.008264462809917 c = 0.789496248792167 y = -0.008130081300813 c = 0.781366167491353 y = 0.008000000000000 c = 0.789366167491353 y = -0.007874015748031 c = 0.781492151743322 y = 0.007751937984496 c = 0.789244089727818 y = -0.007633587786260 c = 0.781610501941559 y = 0.007518796992481 c = 0.789129298934040 y = -0.007407407407407 c = 0.781721891526632 y = 0.007299270072993 c = 0.789021161599625 y = -0.007194244604317 c = 0.781826916995308 y = 0.007092198581560 c = 0.788919115576869 y = -0.006993006993007 c = 0.781926108583862 y = 0.006896551724138 c = 0.788822660308000 y = -0.006802721088435 c = 0.782019939219564 y = 0.006711409395973 c = 0.788731348615538 y = -0.006622516556291 c = 0.782108832059246 y = 0.006535947712418 c = 0.788644779771664 y = -0.006451612903226 c = 0.782193166868439 y = 0.006369426751592 c = 0.788562593620031 y = -0.006289308176101 c = 0.782273285443930 y = 0.006211180124224 c = 0.788484465568154 y = -0.006134969325153 c = 0.782349496243001 y = 0.006060606060606 c = 0.788410102303607 y = -0.005988023952096 c = 0.782422078351511 y = 0.005917159763314 c = 0.788339238114824 y = -0.005847953216374 c = 0.782491284898450 y = 0.005780346820809 c = 0.788271631719260 y = -0.005714285714286 c = 0.782557346004974 y = 0.005649717514124 c = 0.788207063519098 y = -0.005586592178771 c = 0.782620471340327 y = 0.005524861878453 c = 0.788145333218780 y = -0.005464480874317 c = 0.782680852344463 y = 0.005405405405405 c = 0.788086257749869 y = -0.005347593582888 c = 0.782738664166981 y = 0.005291005291005 c = 0.788029669457986 y = -0.005235602094241 c = 0.782794067363745 y = 0.005181347150259 c = 0.787975414514005 y = -0.005128205128205 c = 0.782847209385799 y = 0.005076142131980 c = 0.787923351517779 y = -0.005025125628141 c = 0.782898225889638 y = 0.004975124378109 c = 0.787873350267748 y = -0.004926108374384 c = 0.782947241893364 y = 0.004878048780488 c = 0.787825290673851 y = -0.004830917874396 c = 0.782994372799455 y = 0.004784688995215 c = 0.787779061794671 y = -0.004739336492891 c = 0.783039725301780 y = 0.004694835680751 c = 0.787734560982531 y = -0.004651162790698 c = 0.783083398191833 y = 0.004608294930876 c = 0.787691693122709 y = -0.004566210045662 c = 0.783125483077046 y = 0.004524886877828 c = 0.787650369954874 y = -0.004484304932735 c = 0.783166065022139 y = 0.004444444444444 c = 0.787610509466584 y = -0.004405286343612 c = 0.783205223122971 y = 0.004366812227074 c = 0.787572035350045 y = -0.004329004329004 c = 0.783243031021041 y = 0.004291845493562 c = 0.787534876514603 y = -0.004255319148936 c = 0.783279557365667 y = 0.004219409282700 c = 0.787498966648367 y = -0.004184100418410 c = 0.783314866229957 y = 0.004149377593361 c = 0.787464243823318 y = -0.004115226337449 c = 0.783349017485870 y = 0.004081632653061 c = 0.787430650138931 y = -0.004048582995951 c = 0.783382067142980 y = 0.004016064257028 c = 0.787398131400008 y = -0.003984063745020 c = 0.783414067654988 y = 0.003952569169960 c = 0.787366636824948 y = -0.003921568627451 c = 0.783445068197497 y = 0.003891050583658 c = 0.787336118781155 y = -0.003861003861004 c = 0.783475114920151 y = 0.003831417624521 c = 0.787306532544672 y = -0.003802281368821 c = 0.783504251175851 y = 0.003773584905660 c = 0.787277836081511 y = -0.003745318352060 c = 0.783532517729451 y = 0.003717472118959 c = 0.787249989848411 y = -0.003690036900369 c = 0.783559952948042 y = 0.003663003663004 c = 0.787222956611045 y = -0.003636363636364 c = 0.783586592974682 y = 0.003610108303249 c = 0.787196701277931 y = -0.003584229390681 c = 0.783612471887250 y = 0.003558718861210 c = 0.787171190748460 y = -0.003533568904594 c = 0.783637621843866 y = 0.003508771929825 c = 0.787146393773691 y = -0.003484320557491 c = 0.783662073216199 y = 0.003460207612457 c = 0.787122280828656 y = -0.003436426116838 c = 0.783685854711818 y = 0.003412969283276 c = 0.787098823995094 y = -0.003389830508475 c = 0.783708993486620 y = 0.003367003367003 c = 0.787075996853623 y = -0.003344481605351 c = 0.783731515248272 y = 0.003322259136213 c = 0.787053774384484 y = -0.003300330033003 c = 0.783753444351481 y = 0.003278688524590 c = 0.787032132876071 y = -0.003257328990228 c = 0.783774803885843 y = 0.003236245954693 c = 0.787011049840536 y = -0.003215434083601 c = 0.783795615756934 y = 0.003194888178914 c = 0.786990503935848 y = -0.003174603174603 c = 0.783815900761245 y = 0.003154574132492 c = 0.786970474893737 y = -0.003134796238245 c = 0.783835678655493 y = 0.003115264797508 c = 0.786950943453000 y = -0.003095975232198 c = 0.783854968220802 y = 0.003076923076923 c = 0.786931891297725 y = -0.003058103975535 c = 0.783873787322190 y = 0.003039513677812 c = 0.786913301000002 y = -0.003021148036254 c = 0.783892152963748 y = 0.003003003003003 c = 0.786895155966751 y = -0.002985074626866 c = 0.783910081339885 y = 0.002967359050445 c = 0.786877440390330 y = -0.002949852507375 c = 0.783927587882956 y = 0.002932551319648 c = 0.786860139202604 y = -0.002915451895044 c = 0.783944687307560 y = 0.002898550724638 c = 0.786843238032198 y = -0.002881844380403 c = 0.783961393651794 y = 0.002865329512894 c = 0.786826723164688 y = -0.002849002849003 c = 0.783977720315685 y = 0.002832861189802 c = 0.786810581505487 y = -0.002816901408451 c = 0.783993680097036 y = 0.002801120448179 c = 0.78679480...

3   Pass
x = 1e6; y_correct = 3.141592000000000; assert(isequal(pi_est1(x),y_correct))

c = 0 y = 1 c = 1 y = -0.333333333333333 c = 0.666666666666667 y = 0.200000000000000 c = 0.866666666666667 y = -0.142857142857143 c = 0.723809523809524 y = 0.111111111111111 c = 0.834920634920635 y = -0.090909090909091 c = 0.744011544011544 y = 0.076923076923077 c = 0.820934620934621 y = -0.066666666666667 c = 0.754267954267954 y = 0.058823529411765 c = 0.813091483679719 y = -0.052631578947368 c = 0.760459904732351 y = 0.047619047619048 c = 0.808078952351398 y = -0.043478260869565 c = 0.764600691481833 y = 0.040000000000000 c = 0.804600691481833 y = -0.037037037037037 c = 0.767563654444796 y = 0.034482758620690 c = 0.802046413065486 y = -0.032258064516129 c = 0.769788348549357 y = 0.030303030303030 c = 0.800091378852387 y = -0.028571428571429 c = 0.771519950280959 y = 0.027027027027027 c = 0.798546977307986 y = -0.025641025641026 c = 0.772905951666960 y = 0.024390243902439 c = 0.797296195569399 y = -0.023255813953488 c = 0.774040381615911 y = 0.022222222222222 c = 0.796262603838133 y = -0.021276595744681 c = 0.774986008093452 y = 0.020408163265306 c = 0.795394171358758 y = -0.019607843137255 c = 0.775786328221503 y = 0.018867924528302 c = 0.794654252749805 y = -0.018181818181818 c = 0.776472434567987 y = 0.017543859649123 c = 0.794016294217110 y = -0.016949152542373 c = 0.777067141674737 y = 0.016393442622951 c = 0.793460584297688 y = -0.015873015873016 c = 0.777587568424672 y = 0.015384615384615 c = 0.792972183809287 y = -0.014925373134328 c = 0.778046810674959 y = 0.014492753623188 c = 0.792539564298147 y = -0.014084507042254 c = 0.778455057255894 y = 0.013698630136986 c = 0.792153687392880 y = -0.013333333333333 c = 0.778820354059547 y = 0.012987012987013 c = 0.791807367046560 y = -0.012658227848101 c = 0.779149139198458 y = 0.012345679012346 c = 0.791494818210804 y = -0.012048192771084 c = 0.779446625439720 y = 0.011764705882353 c = 0.791211331322072 y = -0.011494252873563 c = 0.779717078448509 y = 0.011235955056180 c = 0.790953033504689 y = -0.010989010989011 c = 0.779964022515678 y = 0.010752688172043 c = 0.790716710687721 y = -0.010526315789474 c = 0.780190394898247 y = 0.010309278350515 c = 0.790499673248763 y = -0.010101010101010 c = 0.780398663147753 y = 0.009900990099010 c = 0.790299653246763 y = -0.009708737864078 c = 0.780590915382685 y = 0.009523809523810 c = 0.790114724906494 y = -0.009345794392523 c = 0.780768930513971 y = 0.009174311926606 c = 0.789943242440577 y = -0.009009009009009 c = 0.780934233431568 y = 0.008849557522124 c = 0.789783790953691 y = -0.008695652173913 c = 0.781088138779778 y = 0.008547008547009 c = 0.789635147326787 y = -0.008403361344538 c = 0.781231785982249 y = 0.008264462809917 c = 0.789496248792167 y = -0.008130081300813 c = 0.781366167491353 y = 0.008000000000000 c = 0.789366167491353 y = -0.007874015748031 c = 0.781492151743322 y = 0.007751937984496 c = 0.789244089727818 y = -0.007633587786260 c = 0.781610501941559 y = 0.007518796992481 c = 0.789129298934040 y = -0.007407407407407 c = 0.781721891526632 y = 0.007299270072993 c = 0.789021161599625 y = -0.007194244604317 c = 0.781826916995308 y = 0.007092198581560 c = 0.788919115576869 y = -0.006993006993007 c = 0.781926108583862 y = 0.006896551724138 c = 0.788822660308000 y = -0.006802721088435 c = 0.782019939219564 y = 0.006711409395973 c = 0.788731348615538 y = -0.006622516556291 c = 0.782108832059246 y = 0.006535947712418 c = 0.788644779771664 y = -0.006451612903226 c = 0.782193166868439 y = 0.006369426751592 c = 0.788562593620031 y = -0.006289308176101 c = 0.782273285443930 y = 0.006211180124224 c = 0.788484465568154 y = -0.006134969325153 c = 0.782349496243001 y = 0.006060606060606 c = 0.788410102303607 y = -0.005988023952096 c = 0.782422078351511 y = 0.005917159763314 c = 0.788339238114824 y = -0.005847953216374 c = 0.782491284898450 y = 0.005780346820809 c = 0.788271631719260 y = -0.005714285714286 c = 0.782557346004974 y = 0.005649717514124 c = 0.788207063519098 y = -0.005586592178771 c = 0.782620471340327 y = 0.005524861878453 c = 0.788145333218780 y = -0.005464480874317 c = 0.782680852344463 y = 0.005405405405405 c = 0.788086257749869 y = -0.005347593582888 c = 0.782738664166981 y = 0.005291005291005 c = 0.788029669457986 y = -0.005235602094241 c = 0.782794067363745 y = 0.005181347150259 c = 0.787975414514005 y = -0.005128205128205 c = 0.782847209385799 y = 0.005076142131980 c = 0.787923351517779 y = -0.005025125628141 c = 0.782898225889638 y = 0.004975124378109 c = 0.787873350267748 y = -0.004926108374384 c = 0.782947241893364 y = 0.004878048780488 c = 0.787825290673851 y = -0.004830917874396 c = 0.782994372799455 y = 0.004784688995215 c = 0.787779061794671 y = -0.004739336492891 c = 0.783039725301780 y = 0.004694835680751 c = 0.787734560982531 y = -0.004651162790698 c = 0.783083398191833 y = 0.004608294930876 c = 0.787691693122709 y = -0.004566210045662 c = 0.783125483077046 y = 0.004524886877828 c = 0.787650369954874 y = -0.004484304932735 c = 0.783166065022139 y = 0.004444444444444 c = 0.787610509466584 y = -0.004405286343612 c = 0.783205223122971 y = 0.004366812227074 c = 0.787572035350045 y = -0.004329004329004 c = 0.783243031021041 y = 0.004291845493562 c = 0.787534876514603 y = -0.004255319148936 c = 0.783279557365667 y = 0.004219409282700 c = 0.787498966648367 y = -0.004184100418410 c = 0.783314866229957 y = 0.004149377593361 c = 0.787464243823318 y = -0.004115226337449 c = 0.783349017485870 y = 0.004081632653061 c = 0.787430650138931 y = -0.004048582995951 c = 0.783382067142980 y = 0.004016064257028 c = 0.787398131400008 y = -0.003984063745020 c = 0.783414067654988 y = 0.003952569169960 c = 0.787366636824948 y = -0.003921568627451 c = 0.783445068197497 y = 0.003891050583658 c = 0.787336118781155 y = -0.003861003861004 c = 0.783475114920151 y = 0.003831417624521 c = 0.787306532544672 y = -0.003802281368821 c = 0.783504251175851 y = 0.003773584905660 c = 0.787277836081511 y = -0.003745318352060 c = 0.783532517729451 y = 0.003717472118959 c = 0.787249989848411 y = -0.003690036900369 c = 0.783559952948042 y = 0.003663003663004 c = 0.787222956611045 y = -0.003636363636364 c = 0.783586592974682 y = 0.003610108303249 c = 0.787196701277931 y = -0.003584229390681 c = 0.783612471887250 y = 0.003558718861210 c = 0.787171190748460 y = -0.003533568904594 c = 0.783637621843866 y = 0.003508771929825 c = 0.787146393773691 y = -0.003484320557491 c = 0.783662073216199 y = 0.003460207612457 c = 0.787122280828656 y = -0.003436426116838 c = 0.783685854711818 y = 0.003412969283276 c = 0.787098823995094 y = -0.003389830508475 c = 0.783708993486620 y = 0.003367003367003 c = 0.787075996853623 y = -0.003344481605351 c = 0.783731515248272 y = 0.003322259136213 c = 0.787053774384484 y = -0.003300330033003 c = 0.783753444351481 y = 0.003278688524590 c = 0.787032132876071 y = -0.003257328990228 c = 0.783774803885843 y = 0.003236245954693 c = 0.787011049840536 y = -0.003215434083601 c = 0.783795615756934 y = 0.003194888178914 c = 0.786990503935848 y = -0.003174603174603 c = 0.783815900761245 y = 0.003154574132492 c = 0.786970474893737 y = -0.003134796238245 c = 0.783835678655493 y = 0.003115264797508 c = 0.786950943453000 y = -0.003095975232198 c = 0.783854968220802 y = 0.003076923076923 c = 0.786931891297725 y = -0.003058103975535 c = 0.783873787322190 y = 0.003039513677812 c = 0.786913301000002 y = -0.003021148036254 c = 0.783892152963748 y = 0.003003003003003 c = 0.786895155966751 y = -0.002985074626866 c = 0.783910081339885 y = 0.002967359050445 c = 0.786877440390330 y = -0.002949852507375 c = 0.783927587882956 y = 0.002932551319648 c = 0.786860139202604 y = -0.002915451895044 c = 0.783944687307560 y = 0.002898550724638 c = 0.786843238032198 y = -0.002881844380403 c = 0.783961393651794 y = 0.002865329512894 c = 0.786826723164688 y = -0.002849002849003 c = 0.783977720315685 y = 0.002832861189802 c = 0.786810581505487 y = -0.002816901408451 c = 0.783993680097036 y = 0.002801120448179 c = 0.78679480...

Suggested Problems

More from this Author4