Ask Your Question

Coefficients in Polynomial Ring over Symbolic Ring ?

asked 2014-11-24 07:31:49 -0600

Peter Luschny gravatar image

updated 2014-11-26 05:56:07 -0600


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)

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)


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

The answer is:

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 flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-11-24 08:37:57 -0600

kcrisman gravatar image

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.

edit flag offensive delete link more


Do you consider this as a defect?

Peter Luschny gravatar imagePeter Luschny ( 2014-11-24 09:08:33 -0600 )edit

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.)

kcrisman gravatar imagekcrisman ( 2014-11-24 10:23:12 -0600 )edit

answered 2014-11-26 04:32:46 -0600

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-11-24 07:31:49 -0600

Seen: 139 times

Last updated: Nov 26 '14