> On Monday, June 3, 2013 7:12:34 PM UTC-5, Sam math wrote: > > I have a multivariate polynomial and want to keep only up to a > certain degree. I already know how to do this for the univariate case. > > For 1 variable, I'd do: > > R.<x> = PolynomialRing(QQ) > > f = x^4 + x^2 + x^3 + x + 1 > > f = f + O(x^3) > > print f > > #output would be 1 + x + x^2... which is what I want. > > How do I do this for a multivariate polynomial? It says O(.) is not > defined... > > R.<x,y> = PolynomialRing(QQ) > > f = x^3*y^3 + x^2 * y^4 + x*y + x + y + 1 > > How can I chop this polynomial up to a certain degree of x and y? > I.e. I want to keep up until the second degree of x only (regardless > of y). > > I know one way I could go about this is to just redefine the > polynomial by looping through the first few coefficients, but I'm > looking for a more efficient/easier way. > > Thanks!
I think what Sam Math wants to do is this: he has two multivariate polynomials f and g, lets say in x and y. What he wants to do is to multiply f*g, and then throw away all the terms of degree higher than, say, x^100, or even all terms of degree higher than x^100 and y^200. He doesn't necessarily want a beautiful solution. What he wants is an efficient solution. Maybe "looping through the first few coefficients" is the best way to go. But any better solutions would be greatly appreciated. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support?hl=en. For more options, visit https://groups.google.com/groups/opt_out.