looping of equality function
Hi, I have the equation x^4+y^4=z^3
. I want to run each variable from -100
till 100
to see which numbers satisfy this equation. Here is what I have done:
x,y,z= var('x y z')
for x in range(-100, 100):
for y in range(-100, 100):
for z in range(-100, 100):
x^4+y^4==z^3
print(x,y,z)
There is definitely something wrong with the coding that's not giving me the desired answer. Can someone enlighten me, please.
First, use
if
. Second, what answer are you getting? If you are using this code in a Python file (as opposed to a Sage file), then the^
symbol will be interpreted as in Python as bitwise exclusive or (https://docs.python.org/3/reference/e...). In a Sage file,^
is converted to**
.the answers I am planning to obtain is the list of numbers for x, y, z that satisfies the equation x^4+y^4=z^3.
It was clear what answers you were hoping for, but you said it wasn't giving the desired answer. So again: what answers was it giving?
oh sorry... it was giving an error code every time I ran the code.