Cody

Problem 953. Pi Estimate 1

Solution 3472713

Submitted on 29 Oct 2020 at 19:27
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
nMax = 10; y_correct = 3.041840000000000; assert(isequal(pi_est1(nMax),y_correct))

temp = 0.8667 temp = 0.8349 temp = 0.8209 temp = 0.8131 estimate = 3.0418

Assertion failed.

2   Fail
nMax = 1000; y_correct = 3.140593000000000; assert(isequal(pi_est1(nMax),y_correct))

temp = 0.8667 temp = 0.8349 temp = 0.8209 temp = 0.8131 temp = 0.8081 temp = 0.8046 temp = 0.8020 temp = 0.8001 temp = 0.7985 temp = 0.7973 temp = 0.7963 temp = 0.7954 temp = 0.7947 temp = 0.7940 temp = 0.7935 temp = 0.7930 temp = 0.7925 temp = 0.7922 temp = 0.7918 temp = 0.7915 temp = 0.7912 temp = 0.7910 temp = 0.7907 temp = 0.7905 temp = 0.7903 temp = 0.7901 temp = 0.7899 temp = 0.7898 temp = 0.7896 temp = 0.7895 temp = 0.7894 temp = 0.7892 temp = 0.7891 temp = 0.7890 temp = 0.7889 temp = 0.7888 temp = 0.7887 temp = 0.7886 temp = 0.7886 temp = 0.7885 temp = 0.7884 temp = 0.7883 temp = 0.7883 temp = 0.7882 temp = 0.7881 temp = 0.7881 temp = 0.7880 temp = 0.7880 temp = 0.7879 temp = 0.7879 temp = 0.7878 temp = 0.7878 temp = 0.7877 temp = 0.7877 temp = 0.7877 temp = 0.7876 temp = 0.7876 temp = 0.7875 temp = 0.7875 temp = 0.7875 temp = 0.7874 temp = 0.7874 temp = 0.7874 temp = 0.7873 temp = 0.7873 temp = 0.7873 temp = 0.7872 temp = 0.7872 temp = 0.7872 temp = 0.7872 temp = 0.7871 temp = 0.7871 temp = 0.7871 temp = 0.7871 temp = 0.7871 temp = 0.7870 temp = 0.7870 temp = 0.7870 temp = 0.7870 temp = 0.7870 temp = 0.7869 temp = 0.7869 temp = 0.7869 temp = 0.7869 temp = 0.7869 temp = 0.7868 temp = 0.7868 temp = 0.7868 temp = 0.7868 temp = 0.7868 temp = 0.7868 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp...

Assertion failed.

3   Fail
nMax = 1e6; y_correct = 3.141592000000000; assert(isequal(pi_est1(nMax),y_correct))

temp = 0.8667 temp = 0.8349 temp = 0.8209 temp = 0.8131 temp = 0.8081 temp = 0.8046 temp = 0.8020 temp = 0.8001 temp = 0.7985 temp = 0.7973 temp = 0.7963 temp = 0.7954 temp = 0.7947 temp = 0.7940 temp = 0.7935 temp = 0.7930 temp = 0.7925 temp = 0.7922 temp = 0.7918 temp = 0.7915 temp = 0.7912 temp = 0.7910 temp = 0.7907 temp = 0.7905 temp = 0.7903 temp = 0.7901 temp = 0.7899 temp = 0.7898 temp = 0.7896 temp = 0.7895 temp = 0.7894 temp = 0.7892 temp = 0.7891 temp = 0.7890 temp = 0.7889 temp = 0.7888 temp = 0.7887 temp = 0.7886 temp = 0.7886 temp = 0.7885 temp = 0.7884 temp = 0.7883 temp = 0.7883 temp = 0.7882 temp = 0.7881 temp = 0.7881 temp = 0.7880 temp = 0.7880 temp = 0.7879 temp = 0.7879 temp = 0.7878 temp = 0.7878 temp = 0.7877 temp = 0.7877 temp = 0.7877 temp = 0.7876 temp = 0.7876 temp = 0.7875 temp = 0.7875 temp = 0.7875 temp = 0.7874 temp = 0.7874 temp = 0.7874 temp = 0.7873 temp = 0.7873 temp = 0.7873 temp = 0.7872 temp = 0.7872 temp = 0.7872 temp = 0.7872 temp = 0.7871 temp = 0.7871 temp = 0.7871 temp = 0.7871 temp = 0.7871 temp = 0.7870 temp = 0.7870 temp = 0.7870 temp = 0.7870 temp = 0.7870 temp = 0.7869 temp = 0.7869 temp = 0.7869 temp = 0.7869 temp = 0.7869 temp = 0.7868 temp = 0.7868 temp = 0.7868 temp = 0.7868 temp = 0.7868 temp = 0.7868 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7867 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7866 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7865 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7864 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7863 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7862 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7861 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7860 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7859 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7858 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp = 0.7857 temp...

Assertion failed.

Suggested Problems

More from this Author4

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!