# I would like to get the polynomial

asked 2016-03-10 13:27:52 +0200

This post is a wiki. Anyone with karma >750 is welcome to improve it.

R.<x> = PowerSeriesRing(RR)

p(x) = taylor(log(1 + erf(x)), x, 0.0, 10)

p().simplify()


gives me a polynomial in x but the coefficients are not fully evaluated numerically.

How can I obtain this polynomial in this form? Thx Jan

edit retag close merge delete

Sort by ยป oldest newest most voted

p is a symbolic expression:

sage: p.parent()
Callable function ring with argument x
sage: type(p)
<type 'sage.symbolic.expression.Expression'>


If you want an element of R, you should convert it:

sage: R(p)
0.000000000000000 + 1.12837916709551*x - 0.636619772367581*x^2 + 0.102772603301940*x^3 + 0.0191284470090363*x^4 - 0.000209194640314060*x^5 - 0.00169620593157420*x^6 - 0.000590123056121359*x^7 - 0.0000258690355130820*x^8 + 0.0000645183422026163*x^9 + 0.0000297780450524763*x^10

sage: R(p).parent()
Power Series Ring in x over Real Field with 53 bits of precision


If you want a polynomial over RR, you should do:

sage: R.<x> = PolynomialRing(RR)
sage: R(p)
0.0000297780450524763*x^10 + 0.0000645183422026163*x^9 - 0.0000258690355130820*x^8 - 0.000590123056121359*x^7 - 0.00169620593157420*x^6 - 0.000209194640314060*x^5 + 0.0191284470090363*x^4 + 0.102772603301940*x^3 - 0.636619772367581*x^2 + 1.12837916709551*x

more