Cody

Solution 1406403

Submitted on 5 Jan 2018 by Liang MA
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
filetext = fileread('fifth_root.m'); assert(isempty(strfind(filetext, '^')),'^ forbidden') assert(isempty(strfind(filetext, 'power')),'power() forbidden') assert(isempty(strfind(filetext, 'mpower')),'mpower() forbidden') assert(isempty(strfind(filetext, 'realpow')),'realpow() forbidden') assert(isempty(strfind(filetext, 'nthroot')),'nthroot() forbidden') assert(isempty(strfind(filetext, 'roots')),'roots() forbidden')

2   Pass
n = 1/9765625; assert(abs(fifth_root(n)-1/25)<1e-5)

yt = 0.5000 yt = -2.2500 yt = -0.8750 yt = -0.1875 yt = 0.1562 yt = -0.0156 yt = 0.0703 yt = 0.0273 yt = 0.0488 yt = 0.0381 yt = 0.0435 yt = 0.0408 yt = 0.0394 yt = 0.0401 yt = 0.0398 yt = 0.0399 yt = 0.0400 yt = 0.0400 yt = 0.0400 yt = 0.0400 yt = 0.0400 yt = 0.0400 yt = 0.0400 yt = 0.0400 yt = 0.0400 yt = 0.0400

3   Pass
n = 1/5555; assert(abs(fifth_root(n)-0.178263811215444)<1e-5)

yt = 0.5000 yt = -2.2500 yt = -0.8750 yt = -0.1875 yt = 0.1562 yt = 0.3281 yt = 0.2422 yt = 0.1992 yt = 0.1777 yt = 0.1885 yt = 0.1831 yt = 0.1804 yt = 0.1791 yt = 0.1784 yt = 0.1781 yt = 0.1782 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783 yt = 0.1783

4   Pass
n = 1/3125; assert(abs(fifth_root(n)-1/5)<1e-5)

yt = 0.5000 yt = -2.2500 yt = -0.8750 yt = -0.1875 yt = 0.1562 yt = 0.3281 yt = 0.2422 yt = 0.1992 yt = 0.2207 yt = 0.2100 yt = 0.2046 yt = 0.2019 yt = 0.2006 yt = 0.1999 yt = 0.2002 yt = 0.2001 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000 yt = 0.2000

5   Pass
n = 1/125; assert(abs(fifth_root(n)-0.380730787743176)<1e-5)

yt = 0.5000 yt = -2.2500 yt = -0.8750 yt = -0.1875 yt = 0.1562 yt = 0.3281 yt = 0.4141 yt = 0.3711 yt = 0.3926 yt = 0.3818 yt = 0.3765 yt = 0.3792 yt = 0.3805 yt = 0.3812 yt = 0.3808 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807 yt = 0.3807

6   Pass
n = 1/5; assert(abs(fifth_root(n)-0.724779663677696)<1e-5)

yt = 0.5000 yt = 3.2500 yt = 1.8750 yt = 1.1875 yt = 0.8438 yt = 0.6719 yt = 0.7578 yt = 0.7148 yt = 0.7363 yt = 0.7256 yt = 0.7202 yt = 0.7229 yt = 0.7242 yt = 0.7249 yt = 0.7246 yt = 0.7247 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248 yt = 0.7248

7   Pass
n = 1; assert(abs(fifth_root(n)-1)<1e-5)

yt = 0.5000 yt = 3.2500 yt = 1.8750 yt = 1.1875 yt = 0.8438 yt = 1.0156 yt = 0.9297 yt = 0.9727 yt = 0.9941 yt = 1.0049 yt = 0.9995 yt = 1.0022 yt = 1.0009 yt = 1.0002 yt = 0.9998 yt = 1.0000 yt = 0.9999 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000 yt = 1.0000

8   Pass
n = 5; assert(abs(fifth_root(n)-1.37972966146121)<1e-5)

yt = 0.5000 yt = 3.2500 yt = 1.8750 yt = 1.1875 yt = 1.5312 yt = 1.3594 yt = 1.4453 yt = 1.4023 yt = 1.3809 yt = 1.3701 yt = 1.3755 yt = 1.3782 yt = 1.3795 yt = 1.3802 yt = 1.3799 yt = 1.3797 yt = 1.3798 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797 yt = 1.3797

9   Pass
n = 25; assert(abs(fifth_root(n)-1.90365393871588)<1e-5)

yt = 0.5000 yt = 3.2500 yt = 1.8750 yt = 2.5625 yt = 2.2188 yt = 2.0469 yt = 1.9609 yt = 1.9180 yt = 1.8965 yt = 1.9072 yt = 1.9019 yt = 1.9045 yt = 1.9032 yt = 1.9039 yt = 1.9035 yt = 1.9037 yt = 1.9036 yt = 1.9037 yt = 1.9036 yt = 1.9036 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037 yt = 1.9037

10   Pass
n = 50; assert(abs(fifth_root(n)-2.18672414788656)<1e-5)

yt = 0.5000 yt = 3.2500 yt = 1.8750 yt = 2.5625 yt = 2.2188 yt = 2.0469 yt = 2.1328 yt = 2.1758 yt = 2.1973 yt = 2.1865 yt = 2.1919 yt = 2.1892 yt = 2.1879 yt = 2.1872 yt = 2.1869 yt = 2.1867 yt = 2.1868 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867 yt = 2.1867

11   Pass
n = 500; assert(abs(fifth_root(n)-3.46572421577573)<1e-5)

yt = 0.5000 yt = 3.2500 yt = 4.6250 yt = 3.9375 yt = 3.5938 yt = 3.4219 yt = 3.5078 yt = 3.4648 yt = 3.4863 yt = 3.4756 yt = 3.4702 yt = 3.4675 yt = 3.4662 yt = 3.4655 yt = 3.4659 yt = 3.4657 yt = 3.4658 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657 yt = 3.4657

12   Pass
n = 3125; assert(abs(fifth_root(n)-5)<1e-5)

yt = 0.5000 yt = 3.2500 yt = 4.6250 yt = 5.3125 yt = 4.9688 yt = 5.1406 yt = 5.0547 yt = 5.0117 yt = 4.9902 yt = 5.0010 yt = 4.9956 yt = 4.9983 yt = 4.9996 yt = 5.0003 yt = 5.0000 yt = 5.0001 yt = 5.0001 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5.0000 yt = 5

13   Pass
n = 759375; assert(abs(fifth_root(n)-15)<1e-5)

yt = 5.5000 yt = 10.7500 yt = 13.3750 yt = 14.6875 yt = 15.3438 yt = 15.0156 yt = 14.8516 yt = 14.9336 yt = 14.9746 yt = 14.9951 yt = 15.0054 yt = 15.0002 yt = 14.9977 yt = 14.9990 yt = 14.9996 yt = 14.9999 yt = 15.0001 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15.0000 yt = 15

14   Pass
n = 9765625; assert(abs(fifth_root(n)-25)<1e-5)

yt = 10.5000 yt = 18.2500 yt = 22.1250 yt = 24.0625 yt = 25.0312 yt = 24.5469 yt = 24.7891 yt = 24.9102 yt = 24.9707 yt = 25.0010 yt = 24.9858 yt = 24.9934 yt = 24.9972 yt = 24.9991 yt = 25.0000 yt = 24.9996 yt = 24.9998 yt = 24.9999 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25.0000 yt = 25

15   Pass
n = 312500000; assert(abs(fifth_root(n)-50)<1e-5)

16   Pass
n = 75937500000; assert(abs(fifth_root(n)-150)<1e-5)

17   Pass
n = 31250000000000; assert(abs(fifth_root(n)-500)<1e-5)

18   Pass
n = 52658067346875; assert(abs(fifth_root(n)-555)<1e-5)

yt = 275.5000 yt = 415.7500 yt = 485.8750 yt = 520.9375 yt = 538.4688 yt = 547.2344 yt = 551.6172 yt = 553.8086 yt = 554.9043 yt = 555.4521 yt = 555.1782 yt = 555.0413 yt = 554.9728 yt = 555.0070 yt = 554.9899 yt = 554.9985 yt = 555.0027 yt = 555.0006 yt = 554.9995 yt = 555.0001 yt = 554.9998 yt = 554.9999 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555.0000 yt = 555