APL(NARS), 153 chars
{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
Input should be choosen in the way matrix coefficients is square and its determinat is different of 0.
For me there are 2 cases, case 1 there is no (0 0)(0 0) in the argument data points,
case 2 there is 1 (0 0)(0 0) in argument data points.
The book formula for general conic is below, but I modify something in the hope that not change the determinantdelta (b*2B^2)-×ばつa×ばつc×ばつC.
Ax^2+Cy^2+Bxy+Dx+Ey+F=0
For case 1 for build the matrix MM I use this formula below, where v=(1 1 1 1 1)
Ax^2+Cy^2+Bxy+Dx+Ey=1
For case 2 for build the matrix MM I use this formula below, where v=(y)=(the second coordinate 4 points)
Ax^2+Cy^2+Bxy+Dx =y
For find "A C B" I use ̄3↑v⌹M that would return the last 3 numbers of vector of solution, the ones in the position of B C A. I use rationals forin the hope of not have round errors, multiplymultipling the matrix MM for rational 1 1x, in ×ばつ1x.
test:
f←{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
f (1 0)(0 1)(0.5 0.5)(0.3 0.7)(4 9)
hyperbola
f (1.2 5.3)(4.1 5.6)(9.1 2.5)(0 1)(4.2 0)
ellipse
f (5 0)(4 3)(3 4)(0 5)(0 ̄5)
circle
f (1 0)(0 1)(2 1)(3 4)(4 9)
parabola
f ( ̄1 4)(2 2)(6 4)( ̄3 2)(2 5)
ellipse
f (0 0)(1 5)(2 3)(4 8)(9 2)
hyperbola
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
DOMAIN ERROR
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
∧
APL(NARS), 153 chars
{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
Input should be choosen in the way matrix coefficients is square and its determinat is different of 0.
For me there are 2 cases, case 1 there is no (0 0) in the argument data points,
case 2 there is 1 (0 0) in argument data points.
The book formula for general conic is below, but I modify something in the hope that not change the determinant (b*2)-×ばつa×ばつc.
Ax^2+Cy^2+Bxy+Dx+Ey+F=0
For case 1 for build the matrix M I use this formula below, where v=(1 1 1 1 1)
Ax^2+Cy^2+Bxy+Dx+Ey=1
For case 2 for build the matrix M I use this formula below, where v=(y)=(the second coordinate 4 points)
Ax^2+Cy^2+Bxy+Dx =y
For find "A C B" I use ̄3↑v⌹M. I use rationals for the hope of not have round errors, multiply the matrix M for rational 1 1x, in ×ばつ1x.
test:
f←{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
f (1 0)(0 1)(0.5 0.5)(0.3 0.7)(4 9)
hyperbola
f (1.2 5.3)(4.1 5.6)(9.1 2.5)(0 1)(4.2 0)
ellipse
f (5 0)(4 3)(3 4)(0 5)(0 ̄5)
circle
f (1 0)(0 1)(2 1)(3 4)(4 9)
parabola
f ( ̄1 4)(2 2)(6 4)( ̄3 2)(2 5)
ellipse
f (0 0)(1 5)(2 3)(4 8)(9 2)
hyperbola
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
DOMAIN ERROR
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
∧
APL(NARS), 153 chars
{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
Input should be choosen in the way matrix coefficients is square and its determinat is different of 0.
For me there are 2 cases, case 1 there is no (0 0) in the argument data points,
case 2 there is 1 (0 0) in argument data points.
The book formula for general conic is below, but I modify something in the hope that not change delta (B^2)-×ばつC.
Ax^2+Cy^2+Bxy+Dx+Ey+F=0
For case 1 for build the matrix M I use this formula below, where v=(1 1 1 1 1)
Ax^2+Cy^2+Bxy+Dx+Ey=1
For case 2 for build the matrix M I use this formula below, where v=(y)=(the second coordinate 4 points)
Ax^2+Cy^2+Bxy+Dx =y
For find "A C B" I use ̄3↑v⌹M that would return the last 3 numbers of vector of solution, the ones in the position of B C A. I use rationals in the hope of not have round errors, multipling the matrix M for rational 1 1x, in ×ばつ1x.
test:
f←{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
f (1 0)(0 1)(0.5 0.5)(0.3 0.7)(4 9)
hyperbola
f (1.2 5.3)(4.1 5.6)(9.1 2.5)(0 1)(4.2 0)
ellipse
f (5 0)(4 3)(3 4)(0 5)(0 ̄5)
circle
f (1 0)(0 1)(2 1)(3 4)(4 9)
parabola
f ( ̄1 4)(2 2)(6 4)( ̄3 2)(2 5)
ellipse
f (0 0)(1 5)(2 3)(4 8)(9 2)
hyperbola
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
DOMAIN ERROR
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
∧
APL(NARS), 153 chars
{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
Input should be choosen in the way matrix coefficients is square and its determinat is different of 0.
For me there are 2 cases, case 1 there is no (0 0) in the argument data points,
case 2 there is 1 (0 0) in argument data points.
The book formula for general conic is below, but I modify something in the hope that not change the determinant (b*2)×ばつa×ばつc.
Ax^2+Cy^2+Bxy+Dx+Ey+F=0
For case 1 for build the matrix M I use this formula below, where v=(1 1 1 1 1)
Ax^2+Cy^2+Bxy+Dx+Ey=1
For case 2 for build the matrix M I use this formula below, where v=(y)=(the second coordinate 4 points)
Ax^2+Cy^2+Bxy+Dx =y
For find "A C B" I use ̄3↑v⌹M. I use rationals for the hope of not have round errors, multiply the matrix M for rational 1 1x, in ×ばつ1x.
test:
f←{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
f (1 0)(0 1)(0.5 0.5)(0.3 0.7)(4 9)
hyperbola
f (1.2 5.3)(4.1 5.6)(9.1 2.5)(0 1)(4.2 0)
ellipse
f (5 0)(4 3)(3 4)(0 5)(0 ̄5)
circle
f (1 0)(0 1)(2 1)(3 4)(4 9)
parabola
f ( ̄1 4)(2 2)(6 4)( ̄3 2)(2 5)
ellipse
f (0 0)(1 5)(2 3)(4 8)(9 2)
hyperbola
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
DOMAIN ERROR
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
∧
APL(NARS), 153 chars
{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
Input should be choosen in the way matrix coefficients is square and its determinat is different of 0.
For me there are 2 cases, case 1 there is no (0 0) in the argument data points,
case 2 there is 1 (0 0) in argument data points.
The book formula for general conic is below, but I modify something in the hope that not change the determinant (b*2)×ばつa×ばつc.
Ax^2+Cy^2+Bxy+Dx+Ey+F=0
For case 1 for build the matrix M I use this formula below, where v=(1 1 1 1 1)
Ax^2+Cy^2+Bxy+Dx+Ey=1
For case 2 for build the matrix M I use this formula below, where v=(y)=(the second coordinate 4 points)
Ax^2+Cy^2+Bxy+Dx =y
For find "A C B" I use ̄3↑v⌹M. I use rationals for not have round errors.
test:
f←{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
f (1 0)(0 1)(0.5 0.5)(0.3 0.7)(4 9)
hyperbola
f (1.2 5.3)(4.1 5.6)(9.1 2.5)(0 1)(4.2 0)
ellipse
f (5 0)(4 3)(3 4)(0 5)(0 ̄5)
circle
f (1 0)(0 1)(2 1)(3 4)(4 9)
parabola
f ( ̄1 4)(2 2)(6 4)( ̄3 2)(2 5)
ellipse
f (0 0)(1 5)(2 3)(4 8)(9 2)
hyperbola
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
DOMAIN ERROR
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
∧
APL(NARS), 153 chars
{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
Input should be choosen in the way matrix coefficients is square and its determinat is different of 0.
For me there are 2 cases, case 1 there is no (0 0) in the argument data points,
case 2 there is 1 (0 0) in argument data points.
The book formula for general conic is below, but I modify something in the hope that not change the determinant (b*2)×ばつa×ばつc.
Ax^2+Cy^2+Bxy+Dx+Ey+F=0
For case 1 for build the matrix M I use this formula below, where v=(1 1 1 1 1)
Ax^2+Cy^2+Bxy+Dx+Ey=1
For case 2 for build the matrix M I use this formula below, where v=(y)=(the second coordinate 4 points)
Ax^2+Cy^2+Bxy+Dx =y
For find "A C B" I use ̄3↑v⌹M. I use rationals for the hope of not have round errors, multiply the matrix M for rational 1 1x, in ×ばつ1x.
test:
f←{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
f (1 0)(0 1)(0.5 0.5)(0.3 0.7)(4 9)
hyperbola
f (1.2 5.3)(4.1 5.6)(9.1 2.5)(0 1)(4.2 0)
ellipse
f (5 0)(4 3)(3 4)(0 5)(0 ̄5)
circle
f (1 0)(0 1)(2 1)(3 4)(4 9)
parabola
f ( ̄1 4)(2 2)(6 4)( ̄3 2)(2 5)
ellipse
f (0 0)(1 5)(2 3)(4 8)(9 2)
hyperbola
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
DOMAIN ERROR
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
∧
APL(NARS), 157153 chars
{W←⍵⋄M←⊃M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡Wq≡⍵:M v⋄(0 1↓M)M[;1]}⋄⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
Input should be choosen in the way matrix coefficients is square and its determinat is different of 0.
For me there are 2 cases, case 1 there is no (0 0) in the argument data points,
case 2 there is 1 (0 0) in argument data points.
The book formula for general conic is below, but I modify something in the hope that not change the determinant (b*2)×ばつa×ばつc.
Ax^2+Cy^2+Bxy+Dx+Ey+F=0
For case 1 for build the matrix M I use this formula below, where v=(1 1 1 1 1)
Ax^2+Cy^2+Bxy+Dx+Ey=1
For case 2 for build the matrix M I use this formula below, where v=(y)=(the second coordinate 4 points)
Ax^2+Cy^2+Bxy+Dx =y
For find "A C B" I use ̄3↑v⌹M. I use rationals for not have round errors.
test:
f←{W←⍵⋄M←⊃M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡Wq≡⍵:M v⋄(0 1↓M)M[;1]}⋄⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
f (1 0)(0 1)(0.5 0.5)(0.3 0.7)(4 9)
hyperbola
f (1.2 5.3)(4.1 5.6)(9.1 2.5)(0 1)(4.2 0)
ellipse
f (5 0)(4 3)(3 4)(0 5)(0 ̄5)
circle
f (1 0)(0 1)(2 1)(3 4)(4 9)
parabola
f ( ̄1 4)(2 2)(6 4)( ̄3 2)(2 5)
ellipse
f (0 0)(1 5)(2 3)(4 8)(9 2)
hyperbola
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
DOMAIN ERROR
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
∧
APL(NARS), 157 chars
{W←⍵⋄M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡W:M v⋄(0 1↓M)M[;1]}⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
Input should be choosen in the way matrix coefficients is square and its determinat is different of 0.
For me there are 2 cases, case 1 there is no (0 0) in the argument data points,
case 2 there is 1 (0 0) in argument data points.
The book formula for general conic is below, but I modify something in the hope that not change the determinant (b*2)×ばつa×ばつc.
Ax^2+Cy^2+Bxy+Dx+Ey+F=0
For case 1 for build the matrix M I use this formula below, where v=(1 1 1 1 1)
Ax^2+Cy^2+Bxy+Dx+Ey=1
For case 2 for build the matrix M I use this formula below, where v=(y)=(the second coordinate 4 points)
Ax^2+Cy^2+Bxy+Dx =y
For find "A C B" I use ̄3↑v⌹M. I use rationals for not have round errors.
test:
f←{W←⍵⋄M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡W:M v⋄(0 1↓M)M[;1]}⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
f (1 0)(0 1)(0.5 0.5)(0.3 0.7)(4 9)
hyperbola
f (1.2 5.3)(4.1 5.6)(9.1 2.5)(0 1)(4.2 0)
ellipse
f (5 0)(4 3)(3 4)(0 5)(0 ̄5)
circle
f (1 0)(0 1)(2 1)(3 4)(4 9)
parabola
f ( ̄1 4)(2 2)(6 4)( ̄3 2)(2 5)
ellipse
f (0 0)(1 5)(2 3)(4 8)(9 2)
hyperbola
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
DOMAIN ERROR
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
∧
APL(NARS), 153 chars
{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
Input should be choosen in the way matrix coefficients is square and its determinat is different of 0.
For me there are 2 cases, case 1 there is no (0 0) in the argument data points,
case 2 there is 1 (0 0) in argument data points.
The book formula for general conic is below, but I modify something in the hope that not change the determinant (b*2)×ばつa×ばつc.
Ax^2+Cy^2+Bxy+Dx+Ey+F=0
For case 1 for build the matrix M I use this formula below, where v=(1 1 1 1 1)
Ax^2+Cy^2+Bxy+Dx+Ey=1
For case 2 for build the matrix M I use this formula below, where v=(y)=(the second coordinate 4 points)
Ax^2+Cy^2+Bxy+Dx =y
For find "A C B" I use ̄3↑v⌹M. I use rationals for not have round errors.
test:
f←{M←⊃{⍵,(×ばつ/⍵),⍵*2} ̈q←⍵∼⊂0 0⋄v←5⍴1⋄(M v)←{q≡⍵:M v⋄(0 1↓M)M[;1]}⍵⋄(b c a)← ×ばつ1x⋄(b=0)∧a=c:'circle'⋄0>t←(b*2)×ばつa×ばつc:'ellipse'⋄0<t:'hyperbola'⋄'parabola'}
f (1 0)(0 1)(0.5 0.5)(0.3 0.7)(4 9)
hyperbola
f (1.2 5.3)(4.1 5.6)(9.1 2.5)(0 1)(4.2 0)
ellipse
f (5 0)(4 3)(3 4)(0 5)(0 ̄5)
circle
f (1 0)(0 1)(2 1)(3 4)(4 9)
parabola
f ( ̄1 4)(2 2)(6 4)( ̄3 2)(2 5)
ellipse
f (0 0)(1 5)(2 3)(4 8)(9 2)
hyperbola
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
DOMAIN ERROR
f (5 9)( ̄4 ̄3)(2 4)(8 13)( ̄1 1)
∧