3
$\begingroup$

When finding the line between two points, I've been using InterpolatingPolynomial (which I know is probably overkill). I get an answer like the following:

Expand[InterpolatingPolynomial[{{4, -6}, {10, -7}}, x]]

-(44/7) + x/14

I would like this to be reformatted into standard form of a line, e.g. as the expression x-14y-88.

In particular, my initial points are always integer pairs, so the output needed is Ax+By+C where A, B, and C are integers, (A and B relatively prime).

Is there a straightforward way to do this?

(Yes, I could do the math to figure out A, B, and C explicitly, but the heart of my question is wondering if Mathematica has a built in way to convert its default explicit answers into an implicit format.)

$\endgroup$

2 Answers 2

3
$\begingroup$

For example using your code (which do not work for lines parallel with y axis):

InterpolatingPolynomial[{{x1, y1}, {x2, y2}}, x] - y /. x1 -> 1 /. 
 y1 -> 2 /. x2 -> 3 /. y2 -> 5 // FactorTermsList // Last

(* 1 + 3 x - 2 y *)
$\endgroup$
2
$\begingroup$
eq=Expand[InterpolatingPolynomial[{{4, -6}, {10, -7}}, x]];
(LCM@@Denominator[List@@eq])(eq-y)//Expand
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.