In[]:=
eqns={x^2/a^2+y^2/b^21,ykx+m};polyex=Apply[Subtract,eqns,{1}]polys=Numerator[Together[Apply[Subtract,eqns,{1}]]]xpoly=Resultant[polys[[1]],polys[[2]],y]discx=Factor[Discriminant[xpoly,x]](*discriminant*)(*CoefficientList[polyex[[2]],y]*)slope=-CoefficientList[polyex[[2]],x][[2]](*k*)intercept=-CoefficientList[CoefficientList[polyex[[2]],y][[1]],x][[1]](*m*)coeffs=CoefficientList[xpoly,x](*{rootproduct,rootsum}=Together[Most[coeffs]/Last[coeffs]]*){rootsum,rootproduct}={-CoefficientList[xpoly,x][[2]]/Last[coeffs],CoefficientList[xpoly,x][[1]]/Last[coeffs]}(*x1+x2;x1x2*){yrootsum,yrootproduct}=Simplify[Together[{slope*rootsum+2intercept,slope^2*rootproduct+intercept*slope*rootsum+intercept^2}]](*y1+y2;y1y2*)Simplify[rootproduct+yrootproduct](*x1x2+y1y2*)Simplify[2sloperootproduct+interceptrootsum](*x1y2+x2y1*)Chordlength=Simplify[Sqrt[1+slope^2]Sqrt[rootsum^2-4rootproduct]](*AbsAB*)
Out[]=
-1++,-m-kx+y
2
x
2
a
2
y
2
b
Out[]=
{-++,-m-kx+y}
2
a
2
b
2
b
2
x
2
a
2
y
Out[]=
-++2kmx++
2
a
2
b
2
a
2
m
2
a
2
b
2
x
2
a
2
k
2
x
Out[]=
4(+-)
2
a
2
b
2
b
2
a
2
k
2
m
Out[]=
k
Out[]=
m
Out[]=
{-+,2km,+}
2
a
2
b
2
a
2
m
2
a
2
b
2
a
2
k
Out[]=
-+,+
2km
2
a
2
b
2
a
2
k
-+
2
a
2
b
2
a
2
m
2
b
2
a
2
k
Out[]=
+,(-+)+
2m
2
b
2
b
2
a
2
k
2
b
2
a
2
k
2
m
2
b
2
a
2
k
Out[]=
-(1+)++
2
a
2
b
2
k
2
a
2
m
2
b
2
m
2
b
2
a
2
k
Out[]=
-+
2k
2
a
2
b
2
b
2
a
2
k
Out[]=
2(+-)
1+
2
k
2
a
2
b
2
b
2
a
2
k
2
m
2
(+)
2
b
2
a
2
k
In[]:=
-CoefficientList[CoefficientList[polyex[[2]],y][[1]],x][[1]]
Out[]=
m
In[]:=
-CoefficientList[xpoly,x][[1]]
Out[]=
2
a
2
b
2
a
2
m
In[]:=
eqns={x^2/a^2-y^2/b^21,ykx+m};polyex=Apply[Subtract,eqns,{1}]polys=Numerator[Together[Apply[Subtract,eqns,{1}]]]xpoly=Resultant[polys[[1]],polys[[2]],y]discx=Factor[Discriminant[xpoly,x]]slope=-CoefficientList[polyex[[2]],x][[2]]coeffs=CoefficientList[xpoly,x](*{rootproduct,rootsum}=Together[Most[coeffs]/Last[coeffs]]*){rootsum,rootproduct}={-CoefficientList[xpoly,x][[2]]/Last[coeffs],CoefficientList[xpoly,x][[1]]/Last[coeffs]}Chordlength=Simplify[Sqrt[1+slope^2]Sqrt[rootsum^2-4rootproduct]]
Out[]=
-1+-,-m-kx+y
2
x
2
a
2
y
2
b
Out[]=
{-+-,-m-kx+y}
2
a
2
b
2
b
2
x
2
a
2
y
Out[]=
---2kmx+-
2
a
2
b
2
a
2
m
2
a
2
b
2
x
2
a
2
k
2
x
Out[]=
-4(-+-)
2
a
2
b
2
b
2
a
2
k
2
m
Out[]=
k
Out[]=
{--,-2km,-}
2
a
2
b
2
a
2
m
2
a
2
b
2
a
2
k
Out[]=
-,-
2km
2
a
2
b
2
a
2
k
--
2
a
2
b
2
a
2
m
2
b
2
a
2
k
Out[]=
2(-+)
1+
2
k
2
a
2
b
2
b
2
a
2
k
2
m
2
(-)
2
b
2
a
2
k
In[]:=
eqns={y^22px,ykx+m};polyex=Apply[Subtract,eqns,{1}]polys=Numerator[Together[Apply[Subtract,eqns,{1}]]]xpoly=Resultant[polys[[1]],polys[[2]],y]discx=Factor[Discriminant[xpoly,x]]slope=-CoefficientList[polyex[[2]],x][[2]]coeffs=CoefficientList[xpoly,x](*{rootproduct,rootsum}=Together[Most[coeffs]/Last[coeffs]]*){rootsum,rootproduct}={-CoefficientList[xpoly,x][[2]]/Last[coeffs],CoefficientList[xpoly,x][[1]]/Last[coeffs]}Chordlength=Simplify[Sqrt[1+slope^2]Sqrt[rootsum^2-4rootproduct]]
Out[]=
{-2px+,-m-kx+y}
2
y
Out[]=
{-2px+,-m-kx+y}
2
y
Out[]=
2
m
2
k
2
x
Out[]=
-4(2km-p)p
Out[]=
k
Out[]=
{,2km-2p,}
2
m
2
k
Out[]=
,
-2km+2p
2
k
2
m
2
k
Out[]=
2
1+
2
k
p(-2km+p)
4
k
In[]:=
rootsum=-CoefficientList[xpoly,x][[2]]/Last[coeffs]
Out[]=
-+
2km
2
a
2
b
2
a
2
k
In[]:=
rootproduct=CoefficientList[xpoly,x][[1]]/Last[coeffs]
Out[]=
-+
2
a
2
b
2
a
2
m
2
b
2
a
2
k