1

I'm trying to solve an equation of the kind:

f1(x)*m^2 + f2(x)*m*n + f3(x)*n = 0.

f1, f2, f3 are known linear functions with rational coefficients, x is inside the closed known interval [x_0, x_1] of reals, and m, n are unknown positive integers.

My idea was to make a list of some rational elements in the interval and solve the resulting Diophantine equation using a solver. If the Diophantine has no solution, the idea would be to refine the list using new elements from the interval with increasing numerator and denominator factors, and putting them again inside the solver, recursively until a solution is found. However, this solution is terribly ineffective, as the criterion of elements choice is almost completely arbitrary.

Any idea for a more efficient algorithm?

8
  • If you set m = n, then divide both sides by n and gather terms, you get (f1(x) + f2(x))n + f3(x) = 0. So for all x such that f1(x) + f2(x) != 0, m = n = -f3(x)/(f1(x) + f2(x)) is a (possibly fractional, possibly negative) solution. You can set the RHS to 1 and solve for x, then to 2, etc. (There may of course be many solutions with m != n.) Commented Jul 9 at 5:37
  • 1
    Could you clarify what is given or unknown?
    – Clement44
    Commented Jul 9 at 7:18
  • Are you sure the last term is n and not n^2? If that correction is valid, then you could solve for w=m/n where w is a solution of a quadratic equation and use the continued fraction expansion to find a suitable rational approximation. Commented Jul 9 at 11:31
  • Does "given x real defined up to a certain precision" mean you know x0 <= x <= x1 for given x0, x1? are f1, f2, f3 given exactly? (with rational slope?) And do you have constraints on m, n? Or just need some (non-zero?) solution? Or every possible solution?
    – chtz
    Commented Jul 9 at 15:38
  • 1
    Thanks for the comments, I realized the question was misleadingly posed. @LutzLehmann the last term is unfortunately n
    – Emu
    Commented Jul 10 at 8:13

0