Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm not getting access to rectform as part of the object A here. This is a maxima command so you might have some other code that is giving you that access. Anyhow, the following works for me:

var('A x')
assume(A,"complex")
ar=real_part(A)+I*imag_part(A)
ar.subs(real_part(A)==x)

x + I*imag_part(A)

Also, the substitution with a dictionary works for me.

ar.subs({real_part(A):x})

x + I*imag_part(A)

click to hide/show revision 2
update to reflect different sage versions

In Sage 5.0, I'm not getting access to rectform as part of the object A here. This is a maxima command so you might have some other code that is giving you that access. Anyhow, the The following works for me:

var('A x')
assume(A,"complex")
ar=real_part(A)+I*imag_part(A)
ar.subs(real_part(A)==x)

x + I*imag_part(A)

Also, the substitution with a dictionary works for me.

ar.subs({real_part(A):x})

x + I*imag_part(A)

In Sage 5.3, I'm getting access to rectform, and I have the difficulty you are having with realpart. I think it's got to be the difference between realpart and real_part.

Perhaps someone here as insight into the differences.

In Sage 5.0, I'm not getting access to rectform as part of the object A here. The following works for me:

var('A x')
assume(A,"complex")
ar=real_part(A)+I*imag_part(A)
ar.subs(real_part(A)==x)

x + I*imag_part(A)

Also, the substitution with a dictionary works for me.

ar.subs({real_part(A):x})

x + I*imag_part(A)

In Sage 5.3, I'm getting access to rectform, and I have the difficulty you are having with realpart. I think it's got to be the difference between realpart and real_part.

Perhaps someone here as has insight into the differences.