Ask Your Question

Revision history [back]

I don't know about redefining, but you can do something like this:

bI = var('bI', latex_name='\mathbf{i}')
var('a,b')
assume(a, 'real')
assume(b, 'real')
expr = (a + b*I)^3
show(expr.real_part() + bI*expr.imag_part())

Note that getting real and imaginary parts expands the expression, so this may be not what you want.