On Thu, Feb 11, 2010 at 4:45 AM, Simon King <[email protected]> wrote: > Hi! > > In Sage, polynomials are usually printed starting with the leading > term: > sage: R.<t> = ZZ[] > sage: p = R.random_element() > sage: p > 4*t^2 + 6*t + 1 > > But there are people who would (at least if the context is formal > power series) prefer > 1 + 6*t + 4*t^2 > > Is there a way to switch between these to conventions? > > If not: What is the easiest way to transform the polynomial into > something that is printed like 1 + 6*t + 4*t^2 ?
How about: sage: R.<t> = ZZ[] sage: p = R.random_element(degree=5) sage: p -t^5 + t^4 + 9*t^3 - t^2 - 20*t + 1 sage: def rstring(f): ... R = PowerSeriesRing(f.base_ring(), names=f.parent().variable_name()) ... return str(R(f)) sage: print2(p) 1 - 20*t - t^2 + 9*t^3 + t^4 - t^5 -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
