Ask Your Question

Revision history [back]

Try using assume (type assume? at the console or look through the Sage documentation):

sage: var('K1, T1, T2, p, omega')
(K1, T1, T2, p, omega)
sage: assume(K1, 'real')
sage: assume(T1, 'real')
sage: assume(T2, 'real')
sage: W = K1 * p / ((T1 * p - 1) * (T2 * p - 1))
sage: Wa = W(p = I * omega)
sage: Re = Wa.real_part().full_simplify()
sage: Im = Wa.imag_part().full_simplify()
sage: 
sage: print(Re)
-(K1*T1*omega^2 + K1*T2*omega^2)/(T1^2*omega^2 + (T1^2*omega^4 + omega^2)*T2^2 + 1)

Try using assume (type assume? at the console or look through the Sage documentation):

sage: var('K1, T1, T2, p, omega')
(K1, T1, T2, p, omega)
sage: assume(K1, 'real')
sage: assume(T1, 'real')
sage: assume(T2, 'real')

You can also try simplifying your expression, even without the assumptions on K1, T1, and T2:

sage: W = K1 * p / ((T1 * p - 1) * (T2 * p - 1))
sage: Wa = W(p = I * omega)
sage: Re = Wa.real_part().full_simplify()
sage: Im = Wa.imag_part().full_simplify()
sage: 
sage: print(Re)
-(K1*T1*omega^2 + K1*T2*omega^2)/(T1^2*omega^2 + (T1^2*omega^4 + omega^2)*T2^2 + 1)

Try using assume (type assume? at the console or look through the Sage documentation):

sage: var('K1, T1, T2, p, omega')
(K1, T1, T2, p, omega)
sage: assume(K1, 'real')
sage: assume(T1, 'real')
sage: assume(T2, 'real')

You can also try simplifying your expression, even without the assumptions on K1, T1, and T2:

sage: W = K1 * p / ((T1 * p - 1) * (T2 * p - 1))
sage: Wa = W(p = I * omega)
sage: Re = Wa.real_part().full_simplify()
sage: Im = Wa.imag_part().full_simplify()
sage: 
sage: print(Re)
-(K1*T1*omega^2 + K1*T2*omega^2)/(T1^2*omega^2 +  (T1^2*omega^4 + omega^2)*T2^2 + 1)