Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Solving a quartic equation

I'm attempting to rearrange an equation from an answer on the Mathematics StackExchange.

The answer given is this equation:

L2=(ab(t)+p)2((ab(t)+p).(cd(t)ab(t))(cd(t)ab(t))2(cd(t)ab(t)))2

Where a, b, c, d, and p are known 2D points, L is a known length, and t is an unknown scalar. ab(t) indicates interpolation between a and b.

I am interested in rearranging this to solve for t. Here's what I've tried in Sage:

def sqr(var): return var.dot_product(var)
var('ax bx cx dx px ay by cy dy py t L')
a = vector([ax, ay])
b = vector([bx, by])
c = vector([cx, cy])
d = vector([dx, dy])
p = vector([px, py])
g = a - at + bt
h = c - ct + dt
u = p - g
v = h - g
eq = L^2 == sqr(u) - sqr((u.dot_product(v)/sqr(v)) * v)
eq.solve(t)

At the solve step I have observed it to sit for quite a while without producing a result. Two questions:

  1. Am I inputting the problem correctly?

  2. Is there any way to know if this is likely to terminate in a reasonable time? I have no idea what the solver looks like under the hood, and wouldn't want to wait for some O(n!) calculation to terminate :)