Cody

Solution 1681916

Submitted on 28 Nov 2018
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
x0y0 = [-2 5]; P = [0.5 3 -5]; y_correct = 4.3093988461280149175163000679048; tol = 5e-13; assert(abs(distance2polynomial(P,x0y0)-y_correct) < tol)

p1 = -3 -2 p2 = 4.5000 2.0000 10.0000 t2 = 20.2500 18.0000 94.0000 40.0000 100.0000 mi = 20.2500 18.0000 103.0000 52.0000 104.0000 r = -0.1244 + 1.8478i -0.1244 - 1.8478i -0.3200 + 1.1811i -0.3200 - 1.1811i

Array indices must be positive integers or logical values. Error in distance2polynomial (line 15) D = min(polyval(mi(r))) Error in Test1 (line 5) assert(abs(distance2polynomial(P,x0y0)-y_correct) < tol)

2   Fail
x0y0 = [pi, pi]; P = [10]; y_correct = 6.8584073464102067615373566167205; tol = 7e-13; assert(abs(distance2polynomial(P,x0y0)-y_correct) < tol)

p1 = 2.1416 3.1416 p2 = -6.8584 t2 = 47.0378 mi = 4.5864 13.4560 56.9074 r = -1.4669 + 3.2025i -1.4669 - 3.2025i

Array indices must be positive integers or logical values. Error in distance2polynomial (line 15) D = min(polyval(mi(r))) Error in Test2 (line 5) assert(abs(distance2polynomial(P,x0y0)-y_correct) < tol)

3   Fail
x0y0 = [0.25,50]; P = [1 2 3 4 5]; y_correct = 1.6470039192886012020234097061626; tol = 5e-13; assert(abs(distance2polynomial(P,x0y0)-y_correct) < tol)

p1 = -0.7500 0.2500 p2 = 49 48 47 46 45 t2 = 2401 4704 6910 9020 11035 8644 6346 4140 2025 mi = 1.0e+04 * 0.2401 0.4704 0.6910 0.9020 1.1035 0.8644 0.6347 0.4140 0.2025 r = 0.3056 + 0.9323i 0.3056 - 0.9323i 0.2988 + 0.9299i 0.2988 - 0.9299i -0.7998 + 0.5742i -0.7998 - 0.5742i -0.7842 + 0.5766i -0.7842 - 0.5766i

Array indices must be positive integers or logical values. Error in distance2polynomial (line 15) D = min(polyval(mi(r))) Error in Test3 (line 5) assert(abs(distance2polynomial(P,x0y0)-y_correct) < tol)

4   Fail
x0y0 = [-3 -3]; P = [-2 1]; y_correct = 4.4721359549995793928183473374626; tol = 5e-13; assert(abs(distance2polynomial(P,x0y0)-y_correct) < tol)

p1 = -4 -3 p2 = -1 -4 t2 = 1 8 16 mi = 17 32 25 r = -0.9412 + 0.7647i -0.9412 - 0.7647i

Array indices must be positive integers or logical values. Error in distance2polynomial (line 15) D = min(polyval(mi(r))) Error in Test4 (line 5) assert(abs(distance2polynomial(P,x0y0)-y_correct) < tol)

5   Fail
x0y0 = [0 5]; P = [1 0 1]; y_correct = 1.9364916731037084425896326998912; tol = 2e-13; assert(abs(distance2polynomial(P,x0y0)-y_correct) < tol)

p1 = -1 0 p2 = 4 5 4 t2 = 16 40 57 40 16 mi = 16 40 58 40 16 r = -0.7231 + 0.9216i -0.7231 - 0.9216i -0.5269 + 0.6716i -0.5269 - 0.6716i

Array indices must be positive integers or logical values. Error in distance2polynomial (line 15) D = min(polyval(mi(r))) Error in Test5 (line 5) assert(abs(distance2polynomial(P,x0y0)-y_correct) < tol)

6   Fail
x0y0 = [-2 -5]; P = [0.5 3 -5]; y_correct = 1.8901381949770695260066523338279; tol = 2e-13; (abs(distance2polynomial(P,x0y0)-y_correct) < tol)

p1 = -3 -2 p2 = -5.5000 -8.0000 0 t2 = 30.2500 88.0000 64.0000 0 0 mi = 30.2500 88.0000 73.0000 12.0000 4.0000 r = -1.4019 + 0.2972i -1.4019 - 0.2972i -0.0526 + 0.2482i -0.0526 - 0.2482i

Array indices must be positive integers or logical values. Error in distance2polynomial (line 15) D = min(polyval(mi(r))) Error in Test6 (line 5) (abs(distance2polynomial(P,x0y0)-y_correct) < tol)