ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 15 Jun 2021 20:42:36 +0200Thue-Mahler equationhttps://ask.sagemath.org/question/57577/thue-mahler-equation/Let $F \in \mathbb{Z}[X,Y]$ be an homogenous polynomial. An equation of the form
$$ F(X,Y) = d p_1^{a_1}\cdots p_n^{a_n},$$
with $p_1, \cdots, p_n$ are prime numbers and $d \in \mathbb{Z}$ is called a Thue-Mahler equation. Is there an explicit function in sage that can solve this kind of equations even if is a simpler case such as F(x,y) = p^a ?. I have been looking for this with no result.
Joao FedeTue, 15 Jun 2021 20:42:36 +0200https://ask.sagemath.org/question/57577/integer solutions to this system of equationshttps://ask.sagemath.org/question/55517/integer-solutions-to-this-system-of-equations/Consider the following system of two equations:
$$
x + y + z = 24 n + 3
$$
$$
x y z = 576 n³ + 216 n^2 + 27 n - 25
$$
For what value of $n$ are there integer solutions $x$, $y$, $z$?
Can someone help me to write down a code for the above!sonu1997Sun, 31 Jan 2021 15:18:02 +0100https://ask.sagemath.org/question/55517/too many for loopshttps://ask.sagemath.org/question/53647/too-many-for-loops/ I am trying to solve a Diophantine system with more than 20 variables. I have been trying to use:
\\
for a in srange(1,100):
for b in srange(1,a+1):
.
.
.
if (a+b+...)^(1\2) in ZZ and if (a+b+...)^(1/3) in ZZ:
print(a,b,...)
The problem is I have more than 20 variables and hence more than 20 of these for loops and Python doesnt allow that. Any help on an easy workaround would be greatly appreciated! This is not for homework or anything, I am just trying to do some computational research on Diophantine systems and I am running into some trouble. brennanTue, 29 Sep 2020 10:24:15 +0200https://ask.sagemath.org/question/53647/Equation problemhttps://ask.sagemath.org/question/50839/equation-problem/I have the equation
x + y = 15
and I'm looking for solution only in the range x=1..9 and y=1..9, x and y both integer
Is there a sage-command to do that?
I tried it with
var('x, y')
assume(x,"integer")
assume(x>0)
assume(y, "integer")
assume(y>0)
solve(x+y==15,x,y)
The result was
(t_0, -t_0 + 15)
obviously right, but not 6,9 7,8 8,7 and 9,6
Thanks in advance
Bert HenryBert HenrySat, 18 Apr 2020 16:01:45 +0200https://ask.sagemath.org/question/50839/Solving 3rd degree Diophantine equation in Sagehttps://ask.sagemath.org/question/24518/solving-3rd-degree-diophantine-equation-in-sage/Is there a way to find all integer solutions to $y^2=x^3-x/25+9/125$ using Sage? I tried elliptic curves but its command integral_points() won't work as the curve seems not to be an integral model.mathhobbyistSat, 18 Oct 2014 16:17:43 +0200https://ask.sagemath.org/question/24518/What is the SAGE command for calculating a Frobenius numberhttps://ask.sagemath.org/question/42563/what-is-the-sage-command-for-calculating-a-frobenius-number/ This is the WolframAlpha link to what I'm trying to do: reference.wolfram.com/language/tutorial/Frobenius.html
Apparently I can't make the link active or post an image because I don't have the karma! Just add the http to the link above.voodooguruMon, 11 Jun 2018 05:22:37 +0200https://ask.sagemath.org/question/42563/Routines for Pell's equationshttps://ask.sagemath.org/question/40202/routines-for-pells-equations/Hi,
I am interested in finding solutions to Pell's equations in finite fields. Are there Sagemath routines that I could use or should I create my own routines? I am interested in finding out solutions to the general equation x^2 - Dy^2 = 1 (mod p). Solutions to this form an closed Abelian group and the points form a cyclic subgroup.
Any suggestions/pointers would be deeply appreciated.
Thank you,
Rahul RahulKrishnanSun, 17 Dec 2017 17:21:54 +0100https://ask.sagemath.org/question/40202/enumerate integer points in a polytopehttps://ask.sagemath.org/question/23674/enumerate-integer-points-in-a-polytope/ This is a followup question to
http://ask.sagemath.org/question/23666/solving-system-of-linear-diophantine-equations/
$A$ is a $5 \times 19$ matrix. $S=${-1,0,1}. As suggessted in the solution I compute integral points within a polytope.
I have the following code:
eq3=[
(0,6,10,10,6,6,6,3,3,0,3,21,21,0,0,3,3,3,3,3),
(0,12,16,15,13,13,14,7,7,2,8,27,27,1,2,7,7,5,4,6),
(0,6,13,10,9,9,12,6,6,4,10,14,14,0,1,7,7,6,3,3),
(0,0,5,5,0,0,0,0,0,0,0,7,7,0,0,0,0,0,0,0),
(0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0,0,0,0,1,0,0,0,0,0,0,0),(ub,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0),
(-lb,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0),(ub,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0),
(-lb,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0),(ub,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0),
(-lb,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0),(ub,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0),
(-lb,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0),(ub,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0),
(-lb,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0),(ub,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0),
(-lb,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0),(ub,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0),
(-lb,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1),(ub,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1)];
p=Polyhedron(eqns=eq3,ieqs=ineq3,base_ring=QQ)
p.integral_points()
I have the code running for more than 6 hours on my laptop without any output..
Are there any tricks to make the computation faster? Can i keep printing the integral points as they are found?
arunayyarSun, 03 Aug 2014 05:48:46 +0200https://ask.sagemath.org/question/23674/Solving system of linear Diophantine equationshttps://ask.sagemath.org/question/23666/solving-system-of-linear-diophantine-equations/I have an $m \times n$ integer matrix $A$ with $m>n$, and a set $S \subset \mathbb{Z}$, for example $S=\\{-1,0,1\\}$.
I want to enumerate all possible $X \in S^n$ such that $AX=0$.
I tried using smith_form(), but then i could not figure out how to force the solution to belong to elements of $S$.
----------
EDIT. Thank you Dima for the solution. It works well. I am adding an example here to illustrate your solution.
lb = -1
ub = 1
A = matrix(ZZ, [(8,2,10,0,12,2,0), (4,6,9,1,14,5,2), (2,0,1,1,0,1,0), (2,1,3,0,4,0,1)])
eq1 = [(0,8,2,10,0,12,2,0), (0,4,6,9,1,14,5,2), (0,2,0,1,1,0,1,0), (0,2,1,3,0,4,0,1)]
ieq1 = [(-lb,1,0,0,0,0,0,0), (ub,-1,0,0,0,0,0,0),
(-lb,0,1,0,0,0,0,0), (ub,0,-1,0,0,0,0,0),
(-lb,0,0,1,0,0,0,0), (ub,0,0,-1,0,0,0,0),
(-lb,0,0,0,1,0,0,0), (ub,0,0,0,-1,0,0,0),
(-lb,0,0,0,0,1,0,0), (ub,0,0,0,0,-1,0,0),
(-lb,0,0,0,0,0,1,0), (ub,0,0,0,0,0,-1,0),
(-lb,0,0,0,0,0,0,1), (ub,0,0,0,0,0,0,-1)]
p = Polyhedron(eqns=eq1, ieqs=ieq1, base_ring=QQ)
p.integral_points()
returns the answer
((-1, -1, 1, 1, 0, 0, 0),
(0, -1, -1, 1, 1, 0, 0),
(0, -1, 0, -1, 0, 1,1),
(0, 0, 0, 0, 0, 0, 0),
(0, 1, 0, 1, 0, -1, -1),
(0, 1, 1, -1, -1, 0,0),
(1, 1, -1, -1, 0, 0, 0))
which is exactly what i needed. Thanks again.arunayyarSat, 02 Aug 2014 12:17:47 +0200https://ask.sagemath.org/question/23666/Linear diophantine equationshttps://ask.sagemath.org/question/10364/linear-diophantine-equations/Is there any basic function in Sage to solve linear diophantine equations?bakantFri, 19 Jul 2013 03:38:12 +0200https://ask.sagemath.org/question/10364/Solving multilinear integer equationshttps://ask.sagemath.org/question/8699/solving-multilinear-integer-equations/I'd like to explore the solutions of a multilinear diophantine equation like $12(yz) + 6(y+z) +2 -4xw -2(w+x) = 0$. In particular I'd like to generate instances of solutions. I tried the function solve like:
(x,y,z,w) = var('x,y,z,w')
assume(x, 'integer'); assume(y, 'integer')
assume(z, 'integer'); assume(w, 'integer')
solve([12*(y*z) + 6*(y+z) +2 -4*x*w -2*(w+x) == 0, y==y], x)
which gives me the not particularly useful output:
[[x == (3*(2*r1 + 1)*r2 + 3*r1 - r3 + 1)/(2*r3 + 1), y == r1, z == r2, w == r3]]
I'd like to generate some actual quadruples that solve this equation or possibly investigate the structure more. Is there some systematic way to do this? In particular, when playing around with coefficients, is there a test of existence of an integer solution?
**Edit**: I had typos in the first version, I edited the equation.
ThomasMon, 06 Feb 2012 09:06:08 +0100https://ask.sagemath.org/question/8699/