Maxima Function
realpart (expr)
Returns the real part of expr. realpart and imagpart will work on expressions involving trigonometic and hyperbolic functions, as well as square root, logarithm, and exponentiation.
realpart
imagpart