pythonmathsagediophantine

diophantine equation in sagemath


How do I use sagemath to solve this diophantine equation on sagemath:

36n^3 - 32 = xy * (y + 2(6n + x)) ?

This is what I had when I tried this on my MacBook.

sage: solve([36*n^3 -19 == x*y*(y + 2*(6*n + x)),x,y,n])
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[4], line 1
----> 1 solve([Integer(36)*n**Integer(3) -Integer(19) == x*y*(y + Integer(2)*(Integer(6)*n + x)),x,y,n])

File /private/var/tmp/sage-10.5-current/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/sage/symbolic/relation.py:1043, in solve(f, *args, **kwds)
   1041     x = args
   1042 else:
-> 1043     x = args[0]
   1044 if isinstance(x, (list, tuple)):
   1045     for i in x:

IndexError: tuple index out of range 



Solution

  • You are including not only equation but variables within the square brackets.

    Please try instead:

    x, y, n = var('x y n')
    
    solve([36*n^3 - 19 == x*y*(y + 2*(6*n + x))], x, y, n)