Ask Your Question

Revision history [back]

This is because in Sage, pi lives in the Symbolic Ring.

Define pi as an element of CC before defining omega0, as follows:

pi = CC.pi()

and you will obtain the desired behaviour.

This is because in Sage, pi lives in the Symbolic Ring.

Define pi as an element of CC before defining omega0, as follows:

pi = CC.pi()

and you will obtain the desired behaviour.

sage: pi = CC.pi()
sage: s = polygen(CC)
sage: p = 0.894289785676221
sage: e = s^4 + 2.14081977623463*s^3 + 3.15237117897600*s^2 + 2.31898630138664*s + 0.902488008823108
sage: s21 = p/e
sage: s21
0.894289785676221/(x^4 + 2.14081977623463*x^3 + 3.15237117897600*x^2 + 2.31898630138664*x + 0.902488008823108)
sage: s21.parent()
Fraction Field of Univariate Polynomial Ring in x over Complex Field with 53 bits of precision
sage: omega0 = sqrt(2*pi*750e6*2*pi*1250e6)
sage: scaled_s21 = s21.subs(s=omega0/(2*pi*1250e6-2*pi*750e6)*(s/omega0 + omega0/s))
sage: scaled_s21
0.894289785676221/(x^4 + 2.14081977623463*x^3 + 3.15237117897600*x^2 + 2.31898630138664*x + 0.902488008823108)
sage: scaled_s21.parent()
Fraction Field of Univariate Polynomial Ring in x over Complex Field with 53 bits of precision
sage: scaled_s21.numerator()
0.894289785676221
sage: scaled_s21.denominator()
x^4 + 2.14081977623463*x^3 + 3.15237117897600*x^2 + 2.31898630138664*x + 0.902488008823108