Ask Your Question

Revision history [back]

Why does factor() assume that variables are real?

I am sure that I am doing something wrong, so I would appreciate if you could tell me what is going on. Consider the following code:

z1, z2 = var('z1, z2')
term = z1 * z2.conjugate() - z2 * z1.conjugate()
show(term)
show(term.factor())

The first one outputs the correct result, but the second one gives 0. It looks like sage is assuming that things are real when passing to factor(). Is this a bug or the correct behaviour? What do I need to do to avoid this? (Right now, I am expressing all such variables as Real + I * Imag explicitly, but I suspect there is a better way)