Solving a 2 variables equation with Julia, any package

Viewed 98

i am trying to solve:

using SymPy
@syms x y
eq = Equality(x^2 + y^3, 31)
solve(eq)

and i get:

Dict(x => -sqrt(31 - y^3))

Dict(x => sqrt(31 - y^3))

is there a way to get x=2, y=3? Dont need to be with sympy. I am looking for any package that can have the job done. PS: diophantine is not an option as cubics are not implemented yet.

1 Answers

You are solving an underdetermined system but expecting integer solutions so I guess what you want is to pose this as a diophantine problem. I don't know how to do this from Julia but using SymPy directly (in Python) there is a function diophantine for this kind of problem e.g.:

In [3]: diophantine(x**2 + y**2 - 25, [x, y])
Out[3]: {(-5, 0), (-4, -3), (-4, 3), (-3, -4), (-3, 4), (0, -5), (0, 5), (3, -4), (3, 4), (4, -3), (4, 3), (5, 0)}

It doesn't look like your example is implemented though:

In [4]: diophantine(x**2 + y**3 - 31)
---------------------------------------------------------------------------
NotImplementedError: No solver has been written for cubic_thue.
Related