Cody

# Problem 43642. Euclidean distance from a point to a polynomial

Solution 2170896

Submitted on 23 Mar 2020
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)

ans = Columns 1 through 6 1.939500000000000e+04 1.919850000000000e+04 1.900300000000000e+04 1.880850000000000e+04 1.861500000000000e+04 1.842250000000000e+04 Columns 7 through 12 1.823100000000000e+04 1.804050000000000e+04 1.785100000000000e+04 1.766250000000000e+04 1.747500000000000e+04 1.728850000000000e+04 Columns 13 through 18 1.710300000000000e+04 1.691850000000000e+04 1.673500000000000e+04 1.655250000000000e+04 1.637100000000000e+04 1.619050000000000e+04 Columns 19 through 24 1.601100000000000e+04 1.583250000000000e+04 1.565500000000000e+04 1.547850000000000e+04 1.530300000000000e+04 1.512850000000000e+04 Columns 25 through 30 1.495500000000000e+04 1.478250000000000e+04 1.461100000000000e+04 1.444050000000000e+04 1.427100000000000e+04 1.410250000000000e+04 Columns 31 through 36 1.393500000000000e+04 1.376850000000000e+04 1.360300000000000e+04 1.343850000000000e+04 1.327500000000000e+04 1.311250000000000e+04 Columns 37 through 42 1.295100000000000e+04 1.279050000000000e+04 1.263100000000000e+04 1.247250000000000e+04 1.231500000000000e+04 1.215850000000000e+04 Columns 43 through 48 1.200300000000000e+04 1.184850000000000e+04 1.169500000000000e+04 1.154250000000000e+04 1.139100000000000e+04 1.124050000000000e+04 Columns 49 through 54 1.109100000000000e+04 1.094250000000000e+04 1.079500000000000e+04 1.064850000000000e+04 1.050300000000000e+04 1.035850000000000e+04 Columns 55 through 60 1.021500000000000e+04 1.007250000000000e+04 9.931000000000000e+03 9.790500000000000e+03 9.651000000000000e+03 9.512500000000000e+03 Columns 61 through 66 9.375000000000000e+03 9.238500000000000e+03 9.103000000000000e+03 8.968500000000000e+03 8.835000000000000e+03 8.702500000000000e+03 Columns 67 through 72 8.571000000000000e+03 8.440500000000000e+03 8.311000000000000e+03 8.182500000000000e+03 8.055000000000000e+03 7.928500000000000e+03 Columns 73 through 78 7.803000000000000e+03 7.678500000000000e+03 7.555000000000000e+03 7.432500000000000e+03 7.311000000000000e+03 7.190500000000000e+03 Columns 79 through 84 7.071000000000000e+03 6.952500000000000e+03 6.835000000000000e+03 6.718500000000000e+03 6.603000000000000e+03 6.488500000000000e+03 Columns 85 through 90 6.375000000000000e+03 6.262500000000000e+03 6.151000000000000e+03 6.040500000000000e+03 5.931000000000000e+03 5.822500000000000e+03 Columns 91 through 96 5.715000000000000e+03 5.608500000000000e+03 5.503000000000000e+03 5.398500000000000e+03 5.295000000000000e+03 5.192500000000000e+03 Columns 97 through 102 5.091000000000000e+03 4.990500000000000e+03 4.891000000000000e+03 4.792500000000000e+03 4.695000000000000e+03 4.598500000000000e+03 Columns 103 through 108 4.503000000000000e+03 4.408500000000000e+03 4.315000000000000e+03 4.222500000000000e+03 4.131000000000000e+03 4.040500000000000e+03 Columns 109 through 114 3.951000000000000e+03 3.862500000000000e+03 3.775000000000000e+03 3.688500000000000e+03 3.603000000000000e+03 3.518500000000000e+03 Columns 115 through 120 3.435000000000000e+03 3.352500000000000e+03 3.271000000000000e+03 3.190500000000000e+03 3.111000000000000e+03 3.032500000000000e+03 Columns 121 through 126 2.955000000000000e+03 2.878500000000000e+03 2.803000000000000e+03 2.728500000000000e+03 2.655000000000000e+03 2.582500000000000e+03 Columns 127 through 132 2.511000000000000e+03 2.440500000000000e+03 2.371000000000000e+03 2.302500000000000e+03 2.235000000000000e+03 2.168500000000000e+03 Columns 133 through 138 2.103000000000000e+03 2.038500000000000e+03 1.975000000000000e+03 1.912500000000000e+03 1.851000000000000e+03 1.790500000000000e+03 Columns 139 through 144 1.731000000000000e+03 1.672500000000000e+03 1.615000000000000e+03 1.558500000000000e+03 1.503000000000000e+03 1.448500000000000e+03 Columns 145 through 150 1.395000000000000e+03 1.342500000000000e+03 1.291000000000000e+03 1.240500000000000e+03 1.191000000000000e+03 1.142500000000000e+03 Columns 151 through 156 1.095000000000000e+03 1.048500000000000e+03 1.003000000000000e+03 9.585000000000000e+02 9.150000000000000e+02 8.725000000000000e+02 Columns 157 through 162 8.310000000000000e+02 7.905000000000000e+02 7.510000000000000e+02 7.125000000000000e+02 6.750000000000000e+02 6.385000000000000e+02 Columns 163 through 168 6.030000000000000e+02 5.685000000000000e+02 5.350000000000000e+02 5.025000000000000e+02 4.710000000000000e+02 4.405000000000000e+02 Columns 169 through 174 4.110000000000000e+02 3.825000000000000e+02 3.550000000000000e+02 3.285000000000000e+02 3.030000000000000e+02 2.785000000000000e+02 Columns 175 through 180 2.550000000000000e+02 2.325000000000000e+02 2.110000000000000e+02 1.905000000000000e+02 1.710000000000000e+02 1.525000000000000e+02 Columns 181 through 186 1.350000000000000e+02 1.185000000000000e+02 1.030000000000000e+02 8.850000000000000e+01 7.500000000000000e+01 6.250000000000000e+01 Columns 187 through 192 5.100000000000000e+01 4.050000000000000e+01 3.100000000000000e+01 2.250000000000000e+01 1.500000000000000e+01 8.500000000000000e+00 Columns 193 through 198 3.000000000000000e+00 -1.500000000000000e+00 -5.000000000000000e+00 -7.500000000000000e+00 -9.000000000000000e+00 -9.500000000000000e+00 Columns 199 through 204 -9.000000000000000e+00 -7.500000000000000e+00 -5.000000000000000e+00 -1.500000000000000e+00 3.000000000000000e+00 8.500000000000000e+00 Columns 205 through 210 1.500000000000000e+01 2.250000000000000e+01 3.100000000000000e+01 4.050000000000000e+01 5.100000000000000e+01 6.250000000000000e+01 Columns 211 through 216 7.500000000000000e+01 8.850000000000000e+01 1.030000000000000e+02 1.185000000000000e+02 1.350000000000000e+02 1.525000000000000e+02 Columns 217 through 222 1.710000000000000e+02 1.905000000000000e+02 2.110000000000000e+02 2.325000000000000e+02 2.550000000000000e+02 2.785000000000000e+02 Columns 223 through 228 3.030000000000000e+02 3.285000000000000e+02 3.550000000000000e+02 3.825000000000000e+02 4.110000000000000e+02 4.405000000000000e+02 Columns 229 through 234 4.710000000000000e+02 5.025000000000000e+02 5.350000000000000e+02 5.685000000000000e+02 6.030000000000000e+02 6.385000000000000e+02 Columns 235 through 240 6.750000000000000e+02 7.125000000000000e+02 7.510000000000000e+02 7.905000000000000e+02 8.310000000000000e+02 8.725000000000000e+02 Columns 241 through 246 9.150000000000000e+02 9.585000000000000e+02 1.003000000000000e+03 1.048500000000000e+03 1.095000000000000e+03 1.142500000000000e+03 Columns 247 through 252 1.191000000000000e+03 1.240500000000000e+03 1.291000000000000e+03 1.342500000000000e+03 1.395000000000000e+03 1.448500000000000e+03 Columns 253 through 258 1.503000000000000e+03 1.558500000000000e+03 1.615000000000000e+03 1.672500000000000e+03 1.731000000000000e+03 1.790500000000000e+03 Columns 259 through 264 1.851000000000000e+03 1.912500000000000e+03 1.975000000000000e+03 2.038500000000000e+03 2.103000000000000e+03 2.168500000000000e+03 Columns 265 through 270 2.235000000000000e+03 2.302500000000000e+03 2.371000000000000e+03 2.440500000000000e+03 2.511000000000000e+03 2.582500000000000e+03 Columns 271 through 276 2.655000000000000e+03 2.728500000000000e+03 2.803000000000000e+03 2.878500000000000e+03 2.955000000000000e+03 3.032500000000000e+03 Columns 277 through 282 3.111000000000000e+03 3.190500000000000e+03 3.271000000000000e+03 3.352500000000000e+03 3.435000000000000e+03 3.518500000000000e+03 Columns 283 through 288 3.603000000000000e+03 3.688500000000000e+03 3.775000000000000e+03 3.862500000000000e+03 3.951000000000000e+03 4.040500000000000e+03 Columns 289 through 294 4.131000000000000e+03 4.222500000000000e+03 4.315000000000000e+03 4.408500000000000e+03 4.503000000000000e+03 4.598500000000000e+03 Columns 295 through 300 4.695000000000000e+03 4.792500000000000e+03 4.891000000000000e+03 4.990500000000000e+03 5.091000000000000e+03 5.192500000000000e+03 Columns 301 through 306 5.295000000000000e+03 5.398500000000000e+03 5.503000000000000e+03 5.608500000000000e+03 5.715000000000000e+03 5.822500000000000e+03 Columns 307 through 312 5.931000000000000e+03 6.040500000000000e+03 6.151000000000000e+03 6.262500000000000e+03 6.375000000000000e+03 6.488500000000000e+03 Columns 313 through 318 6.603000000000000e+03 6.718500000000000e+03 6.835000000000000e+03 6.952500000000000e+03 7.071000000000000e+03 7.190500000000000e+03 Columns 319 through 324 7.311000000000000e+03 7.432500000000000e+03 7.555000000000000e+03 7.678500000000000e+03 7.803000000000000e+03 7.928500000000000e+03 Columns 325 through 330 8.05500...

Output argument "D" (and maybe others) not assigned during call to "distance2polynomial". 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)

ans = Columns 1 through 30 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 31 through 60 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 61 through 90 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 91 through 120 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 121 through 150 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 151 through 180 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 181 through 210 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 211 through 240 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 241 through 270 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 271 through 300 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 301 through 330 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 331 through 360 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 361 through 390 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 Columns 391 through 401 10 10 10 10 10 10 10 10 10 10 10

Output argument "D" (and maybe others) not assigned during call to "distance2polynomial". 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)

ans = Columns 1 through 6 1.584119205000000e+09 1.552596015000000e+09 1.521545657000000e+09 1.490963379000000e+09 1.460844453000000e+09 1.431184175000000e+09 Columns 7 through 12 1.401977865000000e+09 1.373220867000000e+09 1.344908549000000e+09 1.317036303000000e+09 1.289599545000000e+09 1.262593715000000e+09 Columns 13 through 18 1.236014277000000e+09 1.209856719000000e+09 1.184116553000000e+09 1.158789315000000e+09 1.133870565000000e+09 1.109355887000000e+09 Columns 19 through 24 1.085240889000000e+09 1.061521203000000e+09 1.038192485000000e+09 1.015250415000000e+09 9.926906970000000e+08 9.705090590000000e+08 Columns 25 through 30 9.487012530000000e+08 9.272630550000000e+08 9.061902650000000e+08 8.854787070000000e+08 8.651242290000000e+08 8.451227030000000e+08 Columns 31 through 36 8.254700250000000e+08 8.061621150000000e+08 7.871949170000000e+08 7.685643990000000e+08 7.502665530000000e+08 7.322973950000000e+08 Columns 37 through 42 7.146529650000000e+08 6.973293270000000e+08 6.803225690000000e+08 6.636288030000000e+08 6.472441650000000e+08 6.311648150000000e+08 Columns 43 through 48 6.153869370000000e+08 5.999067390000000e+08 5.847204530000000e+08 5.698243350000000e+08 5.552146650000000e+08 5.408877470000000e+08 Columns 49 through 54 5.268399090000000e+08 5.130675030000000e+08 4.995669050000000e+08 4.863345150000000e+08 4.733667570000000e+08 4.606600790000000e+08 Columns 55 through 60 4.482109530000000e+08 4.360158750000000e+08 4.240713650000000e+08 4.123739670000000e+08 4.009202490000000e+08 3.897068030000000e+08 Columns 61 through 66 3.787302450000000e+08 3.679872150000000e+08 3.574743770000000e+08 3.471884190000000e+08 3.371260530000000e+08 3.272840150000000e+08 Columns 67 through 72 3.176590650000000e+08 3.082479870000000e+08 2.990475890000000e+08 2.900547030000000e+08 2.812661850000000e+08 2.726789150000000e+08 Columns 73 through 78 2.642897970000000e+08 2.560957590000000e+08 2.480937530000000e+08 2.402807550000000e+08 2.326537650000000e+08 2.252098070000000e+08 Columns 79 through 84 2.179459290000000e+08 2.108592030000000e+08 2.039467250000000e+08 1.972056150000000e+08 1.906330170000000e+08 1.842260990000000e+08 Columns 85 through 90 1.779820530000000e+08 1.718980950000000e+08 1.659714650000000e+08 1.601994270000000e+08 1.545792690000000e+08 1.491083030000000e+08 Columns 91 through 96 1.437838650000000e+08 1.386033150000000e+08 1.335640370000000e+08 1.286634390000000e+08 1.238989530000000e+08 1.192680350000000e+08 Columns 97 through 102 1.147681650000000e+08 1.103968470000000e+08 1.061516090000000e+08 1.020300030000000e+08 9.802960500000000e+07 9.414801500000000e+07 Columns 103 through 108 9.038285700000000e+07 8.673177900000000e+07 8.319245300000000e+07 7.976257500000000e+07 7.643986500000000e+07 7.322206700000000e+07 Columns 109 through 114 7.010694900000000e+07 6.709230300000000e+07 6.417594500000000e+07 6.135571500000000e+07 5.862947700000000e+07 5.599511900000000e+07 Columns 115 through 120 5.345055300000000e+07 5.099371500000000e+07 4.862256500000000e+07 4.633508700000000e+07 4.412928900000000e+07 4.200320300000000e+07 Columns 121 through 126 3.995488500000000e+07 3.798241500000000e+07 3.608389700000000e+07 3.425745900000000e+07 3.250125300000000e+07 3.081345500000000e+07 Columns 127 through 132 2.919226500000000e+07 2.763590700000000e+07 2.614262900000000e+07 2.471070300000000e+07 2.333842500000000e+07 2.202411500000000e+07 Columns 133 through 138 2.076611700000000e+07 1.956279900000000e+07 1.841255300000000e+07 1.731379500000000e+07 1.626496500000000e+07 1.526452700000000e+07 Columns 139 through 144 1.431096900000000e+07 1.340280300000000e+07 1.253856500000000e+07 1.171681500000000e+07 1.093613700000000e+07 1.019513900000000e+07 Columns 145 through 150 9.492453000000000e+06 8.826735000000000e+06 8.196665000000000e+06 7.600947000000000e+06 7.038309000000000e+06 6.507503000000000e+06 Columns 151 through 156 6.007305000000000e+06 5.536515000000000e+06 5.093957000000000e+06 4.678479000000000e+06 4.288953000000000e+06 3.924275000000000e+06 Columns 157 through 162 3.583365000000000e+06 3.265167000000000e+06 2.968649000000000e+06 2.692803000000000e+06 2.436645000000000e+06 2.199215000000000e+06 Columns 163 through 168 1.979577000000000e+06 1.776819000000000e+06 1.590053000000000e+06 1.418415000000000e+06 1.261065000000000e+06 1.117187000000000e+06 Columns 169 through 174 9.859890000000000e+05 8.667030000000000e+05 7.585850000000000e+05 6.609150000000000e+05 5.729970000000000e+05 4.941590000000000e+05 Columns 175 through 180 4.237530000000000e+05 3.611550000000000e+05 3.057650000000000e+05 2.570070000000000e+05 2.143290000000000e+05 1.772030000000000e+05 Columns 181 through 186 1.451250000000000e+05 1.176150000000000e+05 9.421700000000000e+04 7.449900000000000e+04 5.805300000000000e+04 4.449500000000000e+04 Columns 187 through 192 3.346500000000000e+04 2.462700000000000e+04 1.766900000000000e+04 1.230300000000000e+04 8.265000000000000e+03 5.315000000000000e+03 Columns 193 through 198 3.237000000000000e+03 1.839000000000000e+03 9.530000000000000e+02 4.350000000000000e+02 1.650000000000000e+02 4.700000000000000e+01 Columns 199 through 204 9.000000000000000e+00 3.000000000000000e+00 5.000000000000000e+00 1.500000000000000e+01 5.700000000000000e+01 1.790000000000000e+02 Columns 205 through 210 4.530000000000000e+02 9.750000000000000e+02 1.865000000000000e+03 3.267000000000000e+03 5.349000000000000e+03 8.303000000000000e+03 Columns 211 through 216 1.234500000000000e+04 1.771500000000000e+04 2.467700000000000e+04 3.351900000000000e+04 4.455300000000000e+04 5.811500000000000e+04 Columns 217 through 222 7.456500000000000e+04 9.428700000000000e+04 1.176890000000000e+05 1.452030000000000e+05 1.772850000000000e+05 2.144150000000000e+05 Columns 223 through 228 2.570970000000000e+05 3.058590000000000e+05 3.612530000000000e+05 4.238550000000000e+05 4.942650000000000e+05 5.731070000000000e+05 Columns 229 through 234 6.610290000000000e+05 7.587030000000000e+05 8.668250000000000e+05 9.861150000000000e+05 1.117317000000000e+06 1.261199000000000e+06 Columns 235 through 240 1.418553000000000e+06 1.590195000000000e+06 1.776965000000000e+06 1.979727000000000e+06 2.199369000000000e+06 2.436803000000000e+06 Columns 241 through 246 2.692965000000000e+06 2.968815000000000e+06 3.265337000000000e+06 3.583539000000000e+06 3.924453000000000e+06 4.289135000000000e+06 Columns 247 through 252 4.678665000000000e+06 5.094147000000000e+06 5.536709000000000e+06 6.007503000000000e+06 6.507705000000000e+06 7.038515000000000e+06 Columns 253 through 258 7.601157000000000e+06 8.196879000000000e+06 8.826953000000000e+06 9.492675000000000e+06 1.019536500000000e+07 1.093636700000000e+07 Columns 259 through 264 1.171704900000000e+07 1.253880300000000e+07 1.340304500000000e+07 1.431121500000000e+07 1.526477700000000e+07 1.626521900000000e+07 Columns 265 through 270 1.731405300000000e+07 1.841281500000000e+07 1.956306500000000e+07 2.076638700000000e+07 2.202438900000000e+07 2.333870300000000e+07 Columns 271 through 276 2.471098500000000e+07 2.614291500000000e+07 2.763619700000000e+07 2.919255900000000e+07 3.081375300000000e+07 3.250155500000000e+07 Columns 277 through 282 3.425776500000000e+07 3.608420700000000e+07 3.798272900000000e+07 3.995520300000000e+07 4.200352500000000e+07 4.412961500000000e+07 Columns 283 through 288 4.633541700000000e+07 4.862289900000000e+07 5.099405300000000e+07 5.345089500000000e+07 5.599546500000000e+07 5.862982700000000e+07 Columns 289 through 294 6.135606900000000e+07 6.417630300000000e+07 6.709266500000000e+07 7.010731500000000e+07 7.322243700000000e+07 7.644023900000000e+07 Columns 295 through 300 7.976295300000000e+07 8.319283500000000e+07 8.673216500000000e+07 9.038324700000000e+07 9.414840900000000e+07 9.803000300000000e+07 Columns 301 through 306 1.020304050000000e+08 1.061520150000000e+08 1.103972570000000e+08 1.147685790000000e+08 1.192684530000000e+08 1.238993750000000e+08 Columns 307 through 312 1.286638650000000e+08 1.335644670000000e+08 1.386037490000000e+08 1.437843030000000e+08 1.491087450000000e+08 1.545797150000000e+08 Columns 313 through 318 1.601998770000000e+08 1.659719190000000e+08 1.718985530000000e+08 1.779825150000000e+08 1.842265650000000e+08 1.906334870000000e+08 Columns 319 through 324 1.972060890000000e+08 2.039472030000000e+08 2.108596850000000e+08 2.179464150000000e+08 2.252102970000000e+08 2.326542590000000e+08 Columns 325 through 330 2.40281...

Output argument "D" (and maybe others) not assigned during call to "distance2polynomial". 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)

ans = Columns 1 through 30 401 399 397 395 393 391 389 387 385 383 381 379 377 375 373 371 369 367 365 363 361 359 357 355 353 351 349 347 345 343 Columns 31 through 60 341 339 337 335 333 331 329 327 325 323 321 319 317 315 313 311 309 307 305 303 301 299 297 295 293 291 289 287 285 283 Columns 61 through 90 281 279 277 275 273 271 269 267 265 263 261 259 257 255 253 251 249 247 245 243 241 239 237 235 233 231 229 227 225 223 Columns 91 through 120 221 219 217 215 213 211 209 207 205 203 201 199 197 195 193 191 189 187 185 183 181 179 177 175 173 171 169 167 165 163 Columns 121 through 150 161 159 157 155 153 151 149 147 145 143 141 139 137 135 133 131 129 127 125 123 121 119 117 115 113 111 109 107 105 103 Columns 151 through 180 101 99 97 95 93 91 89 87 85 83 81 79 77 75 73 71 69 67 65 63 61 59 57 55 53 51 49 47 45 43 Columns 181 through 210 41 39 37 35 33 31 29 27 25 23 21 19 17 15 13 11 9 7 5 3 1 -1 -3 -5 -7 -9 -11 -13 -15 -17 Columns 211 through 240 -19 -21 -23 -25 -27 -29 -31 -33 -35 -37 -39 -41 -43 -45 -47 -49 -51 -53 -55 -57 -59 -61 -63 -65 -67 -69 -71 -73 -75 -77 Columns 241 through 270 -79 -81 -83 -85 -87 -89 -91 -93 -95 -97 -99 -101 -103 -105 -107 -109 -111 -113 -115 -117 -119 -121 -123 -125 -127 -129 -131 -133 -135 -137 Columns 271 through 300 -139 -141 -143 -145 -147 -149 -151 -153 -155 -157 -159 -161 -163 -165 -167 -169 -171 -173 -175 -177 -179 -181 -183 -185 -187 -189 -191 -193 -195 -197 Columns 301 through 330 -199 -201 -203 -205 -207 -209 -211 -213 -215 -217 -219 -221 -223 -225 -227 -229 -231 -233 -235 -237 -239 -241 -243 -245 -247 -249 -251 -253 -255 -257 Columns 331 through 360 -259 -261 -263 -265 -267 -269 -271 -273 -275 -277 -279 -281 -283 -285 -287 -289 -291 -293 -295 -297 -299 -301 -303 -305 -307 -309 -311 -313 -315 -317 Columns 361 through 390 -319 -321 -323 -325 -327 -329 -331 -333 -335 -337 -339 -341 -343 -345 -347 -349 -351 -353 -355 -357 -359 -361 -363 -365 -367 -369 -371 -373 -375 -377 Columns 391 through 401 -379 -381 -383 -385 -387 -389 -391 -393 -395 -397 -399

Output argument "D" (and maybe others) not assigned during call to "distance2polynomial". 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)

ans = Columns 1 through 15 40001 39602 39205 38810 38417 38026 37637 37250 36865 36482 36101 35722 35345 34970 34597 Columns 16 through 30 34226 33857 33490 33125 32762 32401 32042 31685 31330 30977 30626 30277 29930 29585 29242 Columns 31 through 45 28901 28562 28225 27890 27557 27226 26897 26570 26245 25922 25601 25282 24965 24650 24337 Columns 46 through 60 24026 23717 23410 23105 22802 22501 22202 21905 21610 21317 21026 20737 20450 20165 19882 Columns 61 through 75 19601 19322 19045 18770 18497 18226 17957 17690 17425 17162 16901 16642 16385 16130 15877 Columns 76 through 90 15626 15377 15130 14885 14642 14401 14162 13925 13690 13457 13226 12997 12770 12545 12322 Columns 91 through 105 12101 11882 11665 11450 11237 11026 10817 10610 10405 10202 10001 9802 9605 9410 9217 Columns 106 through 120 9026 8837 8650 8465 8282 8101 7922 7745 7570 7397 7226 7057 6890 6725 6562 Columns 121 through 135 6401 6242 6085 5930 5777 5626 5477 5330 5185 5042 4901 4762 4625 4490 4357 Columns 136 through 150 4226 4097 3970 3845 3722 3601 3482 3365 3250 3137 3026 2917 2810 2705 2602 Columns 151 through 165 2501 2402 2305 2210 2117 2026 1937 1850 1765 1682 1601 1522 1445 1370 1297 Columns 166 through 180 1226 1157 1090 1025 962 901 842 785 730 677 626 577 530 485 442 Columns 181 through 195 401 362 325 290 257 226 197 170 145 122 101 82 65 50 37 Columns 196 through 210 26 17 10 5 2 1 2 5 10 17 26 37 50 65 82 Columns 211 through 225 101 122 145 170 197 226 257 290 325 362 401 442 485 530 577 Columns 226 through 240 626 677 730 785 842 901 962 1025 1090 1157 1226 1297 1370 1445 1522 Columns 241 through 255 1601 1682 1765 1850 1937 2026 2117 2210 2305 2402 2501 2602 2705 2810 2917 Columns 256 through 270 3026 3137 3250 3365 3482 3601 3722 3845 3970 4097 4226 4357 4490 4625 4762 Columns 271 through 285 4901 5042 5185 5330 5477 5626 5777 5930 6085 6242 6401 6562 6725 6890 7057 Columns 286 through 300 7226 7397 7570 7745 7922 8101 8282 8465 8650 8837 9026 9217 9410 9605 9802 Columns 301 through 315 10001 10202 10405 10610 10817 11026 11237 11450 11665 11882 12101 12322 12545 12770 12997 Columns 316 through 330 13226 13457 13690 13925 14162 14401 14642 14885 15130 15377 15626 15877 16130 16385 16642 Columns 331 through 345 16901 17162 17425 17690 17957 18226 18497 18770 19045 19322 19601 19882 20165 20450 20737 Columns 346 through 360 21026 21317 21610 21905 22202 22501 22802 23105 23410 23717 24026 24337 24650 24965 25282 Columns 361 through 375 25601 25922 26245 26570 26897 27226 27557 27890 28225 28562 28901 29242 29585 29930 30277 Columns 376 through 390 30626 30977 31330 31685 32042 32401 32762 33125 33490 33857 34226 34597 34970 35345 35722 Columns 391 through 401 36101 36482 36865 37250 37637 38026 38417 38810 39205 39602 40001

Output argument "D" (and maybe others) not assigned during call to "distance2polynomial". 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)

ans = Columns 1 through 6 1.939500000000000e+04 1.919850000000000e+04 1.900300000000000e+04 1.880850000000000e+04 1.861500000000000e+04 1.842250000000000e+04 Columns 7 through 12 1.823100000000000e+04 1.804050000000000e+04 1.785100000000000e+04 1.766250000000000e+04 1.747500000000000e+04 1.728850000000000e+04 Columns 13 through 18 1.710300000000000e+04 1.691850000000000e+04 1.673500000000000e+04 1.655250000000000e+04 1.637100000000000e+04 1.619050000000000e+04 Columns 19 through 24 1.601100000000000e+04 1.583250000000000e+04 1.565500000000000e+04 1.547850000000000e+04 1.530300000000000e+04 1.512850000000000e+04 Columns 25 through 30 1.495500000000000e+04 1.478250000000000e+04 1.461100000000000e+04 1.444050000000000e+04 1.427100000000000e+04 1.410250000000000e+04 Columns 31 through 36 1.393500000000000e+04 1.376850000000000e+04 1.360300000000000e+04 1.343850000000000e+04 1.327500000000000e+04 1.311250000000000e+04 Columns 37 through 42 1.295100000000000e+04 1.279050000000000e+04 1.263100000000000e+04 1.247250000000000e+04 1.231500000000000e+04 1.215850000000000e+04 Columns 43 through 48 1.200300000000000e+04 1.184850000000000e+04 1.169500000000000e+04 1.154250000000000e+04 1.139100000000000e+04 1.124050000000000e+04 Columns 49 through 54 1.109100000000000e+04 1.094250000000000e+04 1.079500000000000e+04 1.064850000000000e+04 1.050300000000000e+04 1.035850000000000e+04 Columns 55 through 60 1.021500000000000e+04 1.007250000000000e+04 9.931000000000000e+03 9.790500000000000e+03 9.651000000000000e+03 9.512500000000000e+03 Columns 61 through 66 9.375000000000000e+03 9.238500000000000e+03 9.103000000000000e+03 8.968500000000000e+03 8.835000000000000e+03 8.702500000000000e+03 Columns 67 through 72 8.571000000000000e+03 8.440500000000000e+03 8.311000000000000e+03 8.182500000000000e+03 8.055000000000000e+03 7.928500000000000e+03 Columns 73 through 78 7.803000000000000e+03 7.678500000000000e+03 7.555000000000000e+03 7.432500000000000e+03 7.311000000000000e+03 7.190500000000000e+03 Columns 79 through 84 7.071000000000000e+03 6.952500000000000e+03 6.835000000000000e+03 6.718500000000000e+03 6.603000000000000e+03 6.488500000000000e+03 Columns 85 through 90 6.375000000000000e+03 6.262500000000000e+03 6.151000000000000e+03 6.040500000000000e+03 5.931000000000000e+03 5.822500000000000e+03 Columns 91 through 96 5.715000000000000e+03 5.608500000000000e+03 5.503000000000000e+03 5.398500000000000e+03 5.295000000000000e+03 5.192500000000000e+03 Columns 97 through 102 5.091000000000000e+03 4.990500000000000e+03 4.891000000000000e+03 4.792500000000000e+03 4.695000000000000e+03 4.598500000000000e+03 Columns 103 through 108 4.503000000000000e+03 4.408500000000000e+03 4.315000000000000e+03 4.222500000000000e+03 4.131000000000000e+03 4.040500000000000e+03 Columns 109 through 114 3.951000000000000e+03 3.862500000000000e+03 3.775000000000000e+03 3.688500000000000e+03 3.603000000000000e+03 3.518500000000000e+03 Columns 115 through 120 3.435000000000000e+03 3.352500000000000e+03 3.271000000000000e+03 3.190500000000000e+03 3.111000000000000e+03 3.032500000000000e+03 Columns 121 through 126 2.955000000000000e+03 2.878500000000000e+03 2.803000000000000e+03 2.728500000000000e+03 2.655000000000000e+03 2.582500000000000e+03 Columns 127 through 132 2.511000000000000e+03 2.440500000000000e+03 2.371000000000000e+03 2.302500000000000e+03 2.235000000000000e+03 2.168500000000000e+03 Columns 133 through 138 2.103000000000000e+03 2.038500000000000e+03 1.975000000000000e+03 1.912500000000000e+03 1.851000000000000e+03 1.790500000000000e+03 Columns 139 through 144 1.731000000000000e+03 1.672500000000000e+03 1.615000000000000e+03 1.558500000000000e+03 1.503000000000000e+03 1.448500000000000e+03 Columns 145 through 150 1.395000000000000e+03 1.342500000000000e+03 1.291000000000000e+03 1.240500000000000e+03 1.191000000000000e+03 1.142500000000000e+03 Columns 151 through 156 1.095000000000000e+03 1.048500000000000e+03 1.003000000000000e+03 9.585000000000000e+02 9.150000000000000e+02 8.725000000000000e+02 Columns 157 through 162 8.310000000000000e+02 7.905000000000000e+02 7.510000000000000e+02 7.125000000000000e+02 6.750000000000000e+02 6.385000000000000e+02 Columns 163 through 168 6.030000000000000e+02 5.685000000000000e+02 5.350000000000000e+02 5.025000000000000e+02 4.710000000000000e+02 4.405000000000000e+02 Columns 169 through 174 4.110000000000000e+02 3.825000000000000e+02 3.550000000000000e+02 3.285000000000000e+02 3.030000000000000e+02 2.785000000000000e+02 Columns 175 through 180 2.550000000000000e+02 2.325000000000000e+02 2.110000000000000e+02 1.905000000000000e+02 1.710000000000000e+02 1.525000000000000e+02 Columns 181 through 186 1.350000000000000e+02 1.185000000000000e+02 1.030000000000000e+02 8.850000000000000e+01 7.500000000000000e+01 6.250000000000000e+01 Columns 187 through 192 5.100000000000000e+01 4.050000000000000e+01 3.100000000000000e+01 2.250000000000000e+01 1.500000000000000e+01 8.500000000000000e+00 Columns 193 through 198 3.000000000000000e+00 -1.500000000000000e+00 -5.000000000000000e+00 -7.500000000000000e+00 -9.000000000000000e+00 -9.500000000000000e+00 Columns 199 through 204 -9.000000000000000e+00 -7.500000000000000e+00 -5.000000000000000e+00 -1.500000000000000e+00 3.000000000000000e+00 8.500000000000000e+00 Columns 205 through 210 1.500000000000000e+01 2.250000000000000e+01 3.100000000000000e+01 4.050000000000000e+01 5.100000000000000e+01 6.250000000000000e+01 Columns 211 through 216 7.500000000000000e+01 8.850000000000000e+01 1.030000000000000e+02 1.185000000000000e+02 1.350000000000000e+02 1.525000000000000e+02 Columns 217 through 222 1.710000000000000e+02 1.905000000000000e+02 2.110000000000000e+02 2.325000000000000e+02 2.550000000000000e+02 2.785000000000000e+02 Columns 223 through 228 3.030000000000000e+02 3.285000000000000e+02 3.550000000000000e+02 3.825000000000000e+02 4.110000000000000e+02 4.405000000000000e+02 Columns 229 through 234 4.710000000000000e+02 5.025000000000000e+02 5.350000000000000e+02 5.685000000000000e+02 6.030000000000000e+02 6.385000000000000e+02 Columns 235 through 240 6.750000000000000e+02 7.125000000000000e+02 7.510000000000000e+02 7.905000000000000e+02 8.310000000000000e+02 8.725000000000000e+02 Columns 241 through 246 9.150000000000000e+02 9.585000000000000e+02 1.003000000000000e+03 1.048500000000000e+03 1.095000000000000e+03 1.142500000000000e+03 Columns 247 through 252 1.191000000000000e+03 1.240500000000000e+03 1.291000000000000e+03 1.342500000000000e+03 1.395000000000000e+03 1.448500000000000e+03 Columns 253 through 258 1.503000000000000e+03 1.558500000000000e+03 1.615000000000000e+03 1.672500000000000e+03 1.731000000000000e+03 1.790500000000000e+03 Columns 259 through 264 1.851000000000000e+03 1.912500000000000e+03 1.975000000000000e+03 2.038500000000000e+03 2.103000000000000e+03 2.168500000000000e+03 Columns 265 through 270 2.235000000000000e+03 2.302500000000000e+03 2.371000000000000e+03 2.440500000000000e+03 2.511000000000000e+03 2.582500000000000e+03 Columns 271 through 276 2.655000000000000e+03 2.728500000000000e+03 2.803000000000000e+03 2.878500000000000e+03 2.955000000000000e+03 3.032500000000000e+03 Columns 277 through 282 3.111000000000000e+03 3.190500000000000e+03 3.271000000000000e+03 3.352500000000000e+03 3.435000000000000e+03 3.518500000000000e+03 Columns 283 through 288 3.603000000000000e+03 3.688500000000000e+03 3.775000000000000e+03 3.862500000000000e+03 3.951000000000000e+03 4.040500000000000e+03 Columns 289 through 294 4.131000000000000e+03 4.222500000000000e+03 4.315000000000000e+03 4.408500000000000e+03 4.503000000000000e+03 4.598500000000000e+03 Columns 295 through 300 4.695000000000000e+03 4.792500000000000e+03 4.891000000000000e+03 4.990500000000000e+03 5.091000000000000e+03 5.192500000000000e+03 Columns 301 through 306 5.295000000000000e+03 5.398500000000000e+03 5.503000000000000e+03 5.608500000000000e+03 5.715000000000000e+03 5.822500000000000e+03 Columns 307 through 312 5.931000000000000e+03 6.040500000000000e+03 6.151000000000000e+03 6.262500000000000e+03 6.375000000000000e+03 6.488500000000000e+03 Columns 313 through 318 6.603000000000000e+03 6.718500000000000e+03 6.835000000000000e+03 6.952500000000000e+03 7.071000000000000e+03 7.190500000000000e+03 Columns 319 through 324 7.311000000000000e+03 7.432500000000000e+03 7.555000000000000e+03 7.678500000000000e+03 7.803000000000000e+03 7.928500000000000e+03 Columns 325 through 330 8.05500...

Output argument "D" (and maybe others) not assigned during call to "distance2polynomial". Error in Test6 (line 5) (abs(distance2polynomial(P,x0y0)-y_correct) < tol)