Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168695
Image: ubuntu2004

Construction of conics

PROBLEM: Determine the equation of a conic if two tangents and three its points are given.

x,y,a,b,c,d,e,f=var('x,y,a,b,c,d,e,f')
A=(0,0) B=(1,0) C=(4,3) t1=x-3*y+1==0 t2=-2*x+y+4==0
plot([point(A,size=50),point(B,size=50),point(C,size=50)],figsize=5,aspect_ratio=1)+implicit_plot(t1,(x,-1,5),(y,-1,5),color='red')+implicit_plot(t2,(x,-1,5),(y,-1,5),color='red')
k=a*x^2+b*x*y+c*y^2+d*x+e*y+f==0
h1=k.substitute(x=A[0],y=A[1]); h2=k.substitute(x=B[0],y=B[1]); h3=k.substitute(x=C[0],y=C[1]) h1; h2; h3
f == 0 a + d + f == 0 16*a + 12*b + 9*c + 4*d + 3*e + f == 0
t1x=solve(t1,x, solution_dict=True); t2x=solve(t2,x, solution_dict=True) t1x; t2x
[{x: 3*y - 1}] [{x: 1/2*y + 2}]
kt1=k.substitute(t1x[0]).lhs(); expand(kt1)
9*a*y^2 + 3*b*y^2 + c*y^2 - 6*a*y - b*y + 3*d*y + e*y + a - d + f
A1=expand(kt1).coeff(y,2); B1=expand(kt1).coeff(y,1); C1=expand(kt1).coeff(y,0) Disc1=B1^2-4*A1*C1; h4=Disc1 h4
-4*(a - d + f)*(9*a + 3*b + c) + (6*a + b - 3*d - e)^2
kt2=k.substitute(t2x[0]).lhs(); expand(kt2)
1/4*a*y^2 + 1/2*b*y^2 + c*y^2 + 2*a*y + 2*b*y + 1/2*d*y + e*y + 4*a + 2*d + f
A2=expand(kt2).coeff(y,2); B2=expand(kt2).coeff(y,1); C2=expand(kt2).coeff(y,0) Disc2=B2^2-4*A2*C2; h5=Disc2 h5
-(a + 2*b + 4*c)*(4*a + 2*d + f) + 1/4*(4*a + 4*b + d + 2*e)^2
Coeff=solve([h1,h2,h3,h4,h5],[a,b,c,d,f],solution_dict=True); Coeff
[{f: 0, b: -13/9*e, a: 2/3*e, d: -2/3*e, c: 19/27*e}, {f: 0, b: -21/17*e, a: 6/17*e, d: -6/17*e, c: 43/51*e}, {f: 0, b: -149/97*e, a: 54/97*e, d: -54/97*e, c: 283/291*e}, {f: 0, b: -7/11*e, a: 2/11*e, d: -2/11*e, c: 3/11*e}]
Q1=expand(k.substitute(Coeff[0])/e); Q2=expand(k.substitute(Coeff[1])/e); Q3=expand(k.substitute(Coeff[2])/e); Q4=expand(k.substitute(Coeff[3])/e) Q1; Q2; Q3; Q4
2/3*x^2 - 13/9*x*y + 19/27*y^2 - 2/3*x + y == 0 6/17*x^2 - 21/17*x*y + 43/51*y^2 - 6/17*x + y == 0 54/97*x^2 - 149/97*x*y + 283/291*y^2 - 54/97*x + y == 0 2/11*x^2 - 7/11*x*y + 3/11*y^2 - 2/11*x + y == 0
plot([point(A,size=50),point(B,size=50),point(C,size=50)],figsize=10)+implicit_plot(t1,(x,-3,6),(y,-3,6),color='red')+implicit_plot(t2,(x,-3,6),(y,-3,6),color='red')+implicit_plot(Q1,(x,-3,6),(y,-3,6),color='black')+implicit_plot(Q2,(x,-3,6),(y,-3,6),color='green')+implicit_plot(Q3,(x,-3,6),(y,-3,6),color='violet')+implicit_plot(Q4,(x,-3,6),(y,-3,6),color='brown')