# Coefficients in Polynomial Ring over Symbolic Ring ?

Consider

x = SR.var('x')
gf = exp(x)*(bessel_I(0, 2*x)-bessel_I(1, 2*x))
t = gf.series(x, 6).simplify_full()
print t.coefficients()
Q.<x> = PolynomialRing(SR)
Q(t)


The output is:

[[Order(x^6) + 1, 0], [1/2, 2], [1/6, 3], [1/8, 4], [1/20, 5]]
1/20*x^5 + 1/8*x^4 + 1/6*x^3 + 1/2*x^2 + Order(x^6) + 1


'Order(x^6)' is a coefficient of a polynomial?

Solution by kcrisman:

x = SR.var('x')
gf = exp(x)*(bessel_I(0, 2*x)-bessel_I(1, 2*x))
t = gf.series(x, 6).truncate().simplify_full()
print t.coefficients()
Q.<x> = PolynomialRing(SR)
Q(t)


EDIT

The answer of rws prompts me to note the following:

u = SR.var('u')
gf = exp(u)*(bessel_I(0, 2*u)-bessel_I(1, 2*u))
s = gf.series(u,6).simplify_full()
R.<x> = PowerSeriesRing(SR)
t = R(s).ogf_to_egf()
print t.parent()
print t


Power Series Ring in x over Symbolic Ring
1/20*u^5 + 1/8*u^4 + 1/6*u^3 + 1/2*u^2 + Order(u^6) + 1


OK, but now delete the transformation ogf_to_egf() in the above code and the answer is -- the same!

edit retag close merge delete

Sort by » oldest newest most voted

I think that perhaps our various Maxima things in simplify_full can't handle power series notation from Pynac, note how +1 so it is taking Order(x^6) as an unknown constant term along with +1. What I would do is truncate the order out first and then do simplifications.

more

I don't know. Probably we should be able to deal with this, yes. Do you want to open a ticket for sending power series to Maxima properly? (We may already, maybe it just doesn't know what to do in the simplification routines - I haven't looked at this at all, and won't have time in the near future. But you should open the ticket, anyway.)

There are practically three bugs:

• there is no SR.function that gets the coefficients of SR.series; rather, coeffs etc give confusing results; truncate must be prepended manually. This is trac #17399.
• even if truncated, the polynomial cannot be converted to a PowerSeries(SR) or Polynomial(SR). The whole symbolic expression is taken as a constant. Your usage of x for everything disguises this. This is trac #16203.

For the problem with simplify_full I have opened trac #17400 but I'm not sure if that ticket is really separate.

more