Cody

# Problem 42580. Conic equation

Solution 724271

Submitted on 27 Aug 2015
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
%% R=5; k=-1; s=-5:5; z=[25 16 9 4 1 0 1 4 9 16 25]/10; t=arrayfun(@(x)conic(x,R,k),s); assert(all(abs(t-z)<=4*eps*abs(z)))

z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN

Assertion failed.

2   Fail
%% R=-5; k=-1; s=-5:5; z=-[25 16 9 4 1 0 1 4 9 16 25]/10; t=arrayfun(@(x)conic(x,R,k),s); assert(all(abs(t-z)<=4*eps*abs(z)))

z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN z1 = NaN

Assertion failed.

3   Fail
%% R=6; k=0; s=0:0.125:2; z=[0 0.001302224649086391 0.005210595859100573 ... 0.01173021649825800 0.02086962844930099 ... 0.03264086885999461 0.04705955010467117 ... 0.06414496470811713 0.08392021690038396 ... 0.1064123829368584 0.1316527028472488 ... 0.1596768068881667 0.1905249806888747 ... 0.2242424739260392 0.2608798583755018 ... 0.3004934424110011 0.3431457505076198]; t=arrayfun(@(x)conic(x,R,k),s); assert(all(abs(t-z)<=4*eps*abs(z)))

z1 = 0 z1 = 0.0013 z1 = 0.0052 z1 = 0.0117 z1 = 0.0209 z1 = 0.0326 z1 = 0.0471 z1 = 0.0641 z1 = 0.0839 z1 = 0.1064 z1 = 0.1317 z1 = 0.1597 z1 = 0.1905 z1 = 0.2242 z1 = 0.2609 z1 = 0.3005 z1 = 0.3431

Assertion failed.

4   Fail
%% R=6800; k=-2; s=10.^(-9:9); z=[7.352941176470588e-23 7.352941176470588e-21 ... 7.352941176470588e-19 7.352941176470588e-17 ... 7.352941176470588e-15 7.352941176470588e-13 ... 7.352941176470548e-11 7.352941176466613e-9 ... 7.352941176073046e-7 0.00007352941136716365 ... 0.007352937201052538 0.7352543677216725 ... 73.13611097583313 5292.973166264779 93430.93334894173 ... 993223.1197327390 9.993202311999733e6 9.99932002312e7 ... 9.9999320002312e8]; t=arrayfun(@(x)conic(x,R,k),s); assert(all(abs(t-z)<=4*eps*abs(z)))

z1 = 0 z1 = 0 z1 = 0 z1 = 0 z1 = 0 z1 = 9.0949e-13 z1 = 7.3669e-11 z1 = 7.3533e-09 z1 = 7.3529e-07 z1 = 7.3529e-05 z1 = 0.0074 z1 = 0.7353 z1 = 73.1361 z1 = 5.2930e+03 z1 = 9.3431e+04 z1 = 9.9322e+05 z1 = 9.9932e+06 z1 = 9.9993e+07 z1 = 9.9999e+08

Assertion failed.

5   Fail
%% R=exp(1); k=pi; s=10.^(-7:0); z=[1.839397205857214e-15 1.839397205857469e-13 ... 1.839397205882986e-11 1.839397208434684e-09 ... 1.839397463604480e-07 0.00001839422981299153 ... 0.001841981926630790 0.2212216213343403]; t=arrayfun(@(x)conic(x,R,k),s); assert(all(abs(t-z)<=4*eps*abs(z)))

z1 = 1.8229e-15 z1 = 1.8389e-13 z1 = 1.8394e-11 z1 = 1.8394e-09 z1 = 1.8394e-07 z1 = 1.8394e-05 z1 = 0.0018 z1 = 0.2212

Assertion failed.

6   Pass