Question: A standard ellipse intersects the line at two points, (x1,y1) and (x2,y2).

Hi, the below code is the equation of a standard ellipse intersects the line at two points, (x1,y1) and (x2,y2).

I wanna "y1+y2" and "y1*y2" generate by specific code auto, no need to input "k*x1_plus_x2 + 2*b" and "b*k*x1_plus_x2 + k^2*x1_by_x2 + b^2" manually. But I don't know how to edit it? maybe sequence?

Any answer and reply is welcome.

restart

The below code is the equation of a standard ellipse intersects the line at two points, (x1,y1) and (x2,y2).

I wanna "y1+y2" and "y1*y2" generate by specific code auto, no need to input "k*x1_plus_x2 + 2*b" and "b*k*x1_plus_x2 + k^2*x1_by_x2 + b^2" manually. But I don't know how to edit it? maybe sequence?

Error, missing operator or `;`

 

C := x^2/A^2+y^2/B^2-1

x^2/A^2+y^2/B^2-1

(1)

l := y = k*x+b

y = k*x+b

(2)

subs(l, C)

x^2/A^2+(k*x+b)^2/B^2-1

(3)

eq := collect(%, {x, x^2})

(1/A^2+k^2/B^2)*x^2+2*b*k*x/B^2+b^2/B^2-1

(4)

x1_plus_x2 := simplify(-coeff(eq, x)/coeff(eq, x^2))

-2*b*k*A^2/(A^2*k^2+B^2)

(5)

x1_by_x2 := simplify(coeff(eq, x, 0)/coeff(eq, x^2))

(-B^2+b^2)*A^2/(A^2*k^2+B^2)

(6)

x1 := solve(eq = 0, x)[1]; x2 := solve(eq = 0, x)[2]

-(b*k*A-(A^2*B^2*k^2+B^4-B^2*b^2)^(1/2))*A/(A^2*k^2+B^2)

 

-(b*k*A+(A^2*B^2*k^2+B^4-B^2*b^2)^(1/2))*A/(A^2*k^2+B^2)

(7)

subs(x1, l); subs(x2, l)
I don't know how to make it like y1=k*x1+b and y2=k*x2+b auto in this procedure.

Error, invalid input: subs received -(b*k*A-(A^2*B^2*k^2+B^4-B^2*b^2)^(1/2))/(A^2*k^2+B^2)*A, which is not valid for its 1st argument

 

Error, invalid input: subs received -(b*k*A+(A^2*B^2*k^2+B^4-B^2*b^2)^(1/2))/(A^2*k^2+B^2)*A, which is not valid for its 1st argument

 

Error, missing operator or `;`

 

y1_plus_y2 := simplify(k*x1_plus_x2+2*b)

2*b*B^2/(A^2*k^2+B^2)

(8)

y1_by_y2 := simplify(b*k*x1_plus_x2+k^2*x1_by_x2+b^2)

B^2*(-A^2*k^2+b^2)/(A^2*k^2+B^2)

(9)
 

 

Download ask_ellispe_and_straight_line.mw

Please Wait...