Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Make sage to don't open brackets while solving equation

Hi, I have an equation

import sympy

...

eq1 = 80*X*e^(T*p) + X*e^(2*T*p) == 5*e^(T*p)/(e^(T*p) - 1) + e^(T*p)/(e^(T*p) - e^(2*T))

and when I do

Xi = eq1.solve(X)
X = Xi[0].right()
X = X.simplify_full()
X = sympy.simplify(X)
X = X.subs(e^(p*T), z)
X = SR(X)

get answer

X = (6*z - 5*e^(2*T) - 1)/(z^3 - z^2*e^(2*T) + 79*z^2 - 79*z*e^(2*T) - 80*z + 80*e^(2*T))

Next I need to find pole of X (z that gives denominator==0). But sagemath opened the brackets in denominator

sage: Xi
[X == -(6*e^(T*p) - 5*e^(2*T) - 1)/(79*e^(T*p + 2*T) + e^(2*T*p + 2*T) + 80*e^(T*p) - 79*e^(2*T*p) - e^(3*T*p) - 80*e^(2*T))]

it's very bad. Here numerator have only 3rd power, but if it will be bigger, sagemath (i think) give me no solution. When I do prevision commands using pen and paper I get in denominator

(z-1)*(z+80)*(z-e^(2*T))

how to get it with sagemath?

(sorry for bad eng.)