On 07/29/2010 11:10 AM, Simon King wrote: > On Jul 29, 3:45 pm, eggartmumie <eggartmu...@googlemail.com> wrote: >>> sage: p>>1 >>> -x + 4/9 >> >> sorry, in reading reference.pdf I never came across this operation, > > Sorry, I don't know if the shift operator for polynomials is explained > somewhere. > >> I just did not know that You can shift a polynomial! > > And this can certainly not be detected by tab completion. Sorry again.
It definitely wasn't obvious to me, but sage: R.<x> = ZZ['t'][] sage: p = R.random_element(6) sage: p.shift? seems to help. >> This is exactly what I intended to get by calling the function (!) >> goppapolynomial with parameters ZZ['t'] and var('x'), expecting it to >> return the polynomial >> (-3*t^2 - t - 1)*x^2 + (t^2 - t + 1)*x - 3*t - 2 >> over ZZ['t'] in indeterminant x. I was confused by the different >> result I get on f = goppapolynomial(F,z) when printing >> type(f) >> or >> f.parent() > > Yes, the difference between type(f) and f.parent() is quite important, > though certainly not easy. > > I guess a first approximation can be phrased like this: The type tells > you how an object is implemented. The parent tells you to what > algebraic structure it belongs. Objects of the same type can have very > different parents, and theoretically objects of different types can Could you please give an example? Do you mean that for a given parent an element could be implemented with FLINT or Singular, say? > have the same parent. > >> Even though I use tab completion quite a lot I did not find the >> methods coefficient and coeffs because I only tried the tab completion >> on the rings and not on their elements, the polynomials. > > If you want to *get* the coefficients from an existing polynomial, I > think using tab completion on this polynomial is natural. However, > from your example c[0]*y^0+c[1]*y^1+c[2]*y^2, it seems that you have a > list of coefficients and a ring and want to get an element of that > ring. > > Here, the answer *should* be available with "R?", because this will > also show you the documentation of the call method. Unfortunately, it > seems that calling a univariate polynomial ring R['x'] on a list, like > R['x']([1,3,0,1]), is not sufficiently documented. Thanks for a very informative thread! -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org