ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 30 Sep 2017 15:10:40 -0500Solving two-variable equations mod phttps://ask.sagemath.org/question/39003/solving-two-variable-equations-mod-p/ I am able to, in wolfram alpha, plug in the equation
> 11=x*(y^119)^149mod151
and wolfram is able to give me a set of non-zero solutions (x,y) that I think satisfy (11*y^119, y)
I have tried using symbolic equations and the sage quickstart for number theory to replicate this functionality, but I am getting stuck on some integer conversion TypeErrors in sage.
I have tried to set it up like:
> x,y = var('x,y');
> qe=(mod(x*(y^119)^149,151)==mod(11,151))
Can someone help me set up this equation, and then solve for all possible non-zero solutions?
THanks!Fri, 29 Sep 2017 08:13:34 -0500https://ask.sagemath.org/question/39003/solving-two-variable-equations-mod-p/Comment by dan_fulea for <p>I am able to, in wolfram alpha, plug in the equation </p>
<blockquote>
<p>11=x*(y^119)^149mod151</p>
</blockquote>
<p>and wolfram is able to give me a set of non-zero solutions (x,y) that I think satisfy (11*y^119, y)</p>
<p>I have tried using symbolic equations and the sage quickstart for number theory to replicate this functionality, but I am getting stuck on some integer conversion TypeErrors in sage. </p>
<p>I have tried to set it up like:</p>
<blockquote>
<p>x,y = var('x,y');</p>
<p>qe=(mod(x*(y^119)^149,151)==mod(11,151))</p>
</blockquote>
<p>Can someone help me set up this equation, and then solve for all possible non-zero solutions?</p>
<p>THanks!</p>
https://ask.sagemath.org/question/39003/solving-two-variable-equations-mod-p/?comment=39009#post-id-39009The equation is:
$$x=11y^{119}\ ?$$Sat, 30 Sep 2017 15:10:40 -0500https://ask.sagemath.org/question/39003/solving-two-variable-equations-mod-p/?comment=39009#post-id-39009Comment by dan_fulea for <p>I am able to, in wolfram alpha, plug in the equation </p>
<blockquote>
<p>11=x*(y^119)^149mod151</p>
</blockquote>
<p>and wolfram is able to give me a set of non-zero solutions (x,y) that I think satisfy (11*y^119, y)</p>
<p>I have tried using symbolic equations and the sage quickstart for number theory to replicate this functionality, but I am getting stuck on some integer conversion TypeErrors in sage. </p>
<p>I have tried to set it up like:</p>
<blockquote>
<p>x,y = var('x,y');</p>
<p>qe=(mod(x*(y^119)^149,151)==mod(11,151))</p>
</blockquote>
<p>Can someone help me set up this equation, and then solve for all possible non-zero solutions?</p>
<p>THanks!</p>
https://ask.sagemath.org/question/39003/solving-two-variable-equations-mod-p/?comment=39008#post-id-39008What does it mean *solutions (x,y) that [...] satisfy (11*y^119, y)* ?
There is no need to "solve", for we can simply isolate $x$ in the equation. Of course, $x,y\ne 0$ in the field $F=\mathbb F_p$ with $p=151$ elements. And for each $y\ne 0$, we can obtain the corresponding $x$. Also, why use the complicated expression
$$ (y^{119})^{149} = y^{119\cdot 149}$$
in the field $F$, where $a^p=a$ for all $a\in F$? (Fermat.)
Code for the tuples:
p = 151
F = GF(p)
g = ( 119 * 149 ) % (p-1)
sols = []
for y in F:
if y == F(0): continue
x = F(11) / y^g
sols.append( (x,y) )
sols = sorted( sols, key=lambda sol: sol[0] )
for sol in sols:
print "x=%3s y=%3s" % sol
Remove the `sorted` line if $y$ is the main variable.Sat, 30 Sep 2017 15:10:00 -0500https://ask.sagemath.org/question/39003/solving-two-variable-equations-mod-p/?comment=39008#post-id-39008