1 | initial version |
The problem is that you use floating point numbers. For them the operation are unexact and lcm(p^2, p) is likely to be p^3 rather than being p^2 even with simple expressions
sage: p = 2.1*z^2 + 0.1
sage: (1/p + 1/p**2).full_simplify()
(4.41*z^4 + 2.52*z^2 + 0.11)/(9.261000000000001*z^6 + 1.323*z^4 + 0.06300000000000001*z^2 + 0.001)
If you exact numbers like integers or rationals this is fine
sage: g1=12108*s^4 + 3016*s^3 + 10600*s^2 + 1937*s + 409/s + 472/s^2 + 28/s^3 + 24/s^4 + 3397
sage: g2=g1.subs(s=((z-1)/(z+1)))
sage: g2.full_simplify()
(31991*z^8 - 158168*z^7 + 408320*z^6 - 668856*z^5 + 758902*z^4 - 603528*z^3 + 332472*z^2 - 116200*z + 21211)/(z^8 - 4*z^6 + 6*z^4 - 4*z^2 + 1)
2 | No.2 Revision |
The problem is that you use floating point numbers. For them the operation are unexact and lcm(p^2, p) is likely to be p^3 rather than being p^2 even with simple expressions
sage: p = 2.1*z^2 + 0.1
sage: f = (1/p + 1/p**2).full_simplify()
sage: f
(4.41*z^4 + 2.52*z^2 + 0.11)/(9.261000000000001*z^6 + 1.323*z^4 + 0.06300000000000001*z^2 + 0.001)
sage: (p^3).expand()
9.26100000000000*z^6 + 1.32300000000000*z^4 + 0.0630000000000000*z^2 + 0.00100000000000000
If you exact numbers like integers or rationals this is fine
sage: g1=12108*s^4 + 3016*s^3 + 10600*s^2 + 1937*s + 409/s + 472/s^2 + 28/s^3 + 24/s^4 + 3397
sage: g2=g1.subs(s=((z-1)/(z+1)))
sage: g2.full_simplify()
(31991*z^8 - 158168*z^7 + 408320*z^6 - 668856*z^5 + 758902*z^4 - 603528*z^3 + 332472*z^2 - 116200*z + 21211)/(z^8 - 4*z^6 + 6*z^4 - 4*z^2 + 1)