How to get a true/false for complex numbers

I'm trying to compare complex numbers in euler form. 260 and 100 is supposed to be degrees, not radiant. (How do I input that=

My input:

e^(i*260) == e^(-i*100)

Expected output:

true

Actual output:

e^(260*I) == e^(-100*I)

What did I do wrong and is my formatting correct? Please not that I'm new to sage. Thank you :)

edit retag close merge delete

Sort by » oldest newest most voted

In Sage, == is used both for comparison as in Python, and as an equality symbol in symbolic equations.

So when you type

e^(i*260) == e^(-i*100)

since e^(i*260) and e^(-i*100) live in Sage's "symbolic ring" (which is where symbolic expressions live in Sage), == is interpreted as the equation equality. This is why the output is the equation

e^(i*260) == e^(-i*100)

If you want to evaluate whether the equation holds or not, you can apply bool to it:

bool(e^(i*260) == e^(-i*100))

and this will force the evaluation and return True or False.

Note that True means Sage was able to prove that the equality holds, while False means it either knows the equality does not hold, or could not prove that the equality holds.

If you don't want to retype the equation, give it a name.

sage: eq = e^(i*260) == e^(-i*100)
sage: eq
e^(i*260) == e^(-i*100)
sage: bool(eq)
False

By the way, did you mean 260 and -100 as angle measures in degrees? You should convert to radians.

sage: eqq = e^(i*260*pi/180) == e^(-i*100*pi/180)
sage: eqq
e^(13/9*I*pi) == e^(-5/9*I*pi)
sage: bool(eqq)
True
more