2020-04-23 20:00:38 -0500 asked a question How to base change from a PolynomialRing to that Ring with one variable evaluated, i.e., from Q[x,y] to Q[x,y]/(x=0) = Q[y]? I am trying to base change a Laurent series ring element from its base ring, Q[u1, u2, u3], to a quotient of its base ring, Q[u2, u3], but I am quite confused in forming this quotient. My setting is this: S. = QQ[] L. = LaurentSeriesRing(S); f = -4*z - 4/5*u1*z^5 + (-4/9*u1^2 - 8/9*u2)*z^9 + (-4/13*u1^3 - 24/13*u1*u2 - 12/13*u3)*z^13 + (-4/17*u1^4 - 48/17*u1^2*u2 - 24/17*u2^2 - 48/17*u1*u3 + 16/17*u1 + 16/17*u2 + 16/17*u3 + 16/17)*z^17 + O(z^20)  In other words, I wish to set u1 = 0, and look at f over that ring. I tried the following two things, which spit out f unchanged. f.change_ring(S.quo(u1)) R = S.quotient(u1) f.change_ring(R)  I also tried the following which gives an attribute error: f.reduce(u1)  I am completely stuck and would deeply appreciate any help. I would also like to eventually set u2 = 0 and look at f over that ring, which I mention at the off chance that this changes the answer at all. 2020-04-19 18:34:51 -0500 received badge ● Notable Question (source) 2020-04-19 13:54:05 -0500 commented answer Why is sage not recognizing symmetric polynomials as symmetric? Ah! Thank you very much. 2020-04-18 22:36:04 -0500 asked a question Why is sage not recognizing symmetric polynomials as symmetric? I am trying to decompose symmetric polynomials into polynomial combinations of elementary symmetric polynomials. It has been driving me absolutely up the wall, and I would be very grateful for any help. It works perfectly with 2 variables. S.=QQ[] f = (x0-x1)*(x1-x0) Sym = SymmetricFunctions(QQ) g = Sym.from_polynomial(f) print g  For 3 variables it fails. Sage throws a type error and says the polynomial f is not symmetric, even though it is certainly invariant under the action of the symmetric group of order 3. S.=QQ[] f = (x0-x1)*(x1-x2)*(x2-x0) Sym = SymmetricFunctions(QQ) g = Sym.from_polynomial(f) print g  The type error is as folliows: /sage/combinat/sf/sf.pyc in from_polynomial(self, f) 1372 ValueError: x0 + 2*x1 + x2 is not a symmetric polynomial 1373 """ -> 1374 return self.m().from_polynomial(f) 1375 1376 def register_isomorphism(self, morphism, only_conversion=False):  However, the following does not throw a type error, perhaps because it is a linear combination of the elementary basis rather than a polynomial one. I don't understand what is going on. Why is this type error being triggered for a valid symmetric polynomial? Thank you very much for your time. S.=QQ[] f = (x0+x1)*(x1+x2)*(x2+x0) Sym = SymmetricFunctions(QQ) g = Sym.from_polynomial(f)  2020-03-06 17:14:07 -0500 received badge ● Popular Question (source) 2020-01-30 20:00:56 -0500 received badge ● Popular Question (source) 2019-11-22 22:41:21 -0500 asked a question How to count rational points of a curve defined as an intersection of two zero sets? I would like to count the points of a variety over $\mathbb{F}_q[t, a, b]/(t^{3^m}-t - a, t^{3^{m+1}} - t - b)$, defined as the zero set of $$x^3 - x - \frac{b}{a\sqrt{a}}$$ intersected with the zero set of $$y^3 - y - h(x, a, b),$$ where $q=3^n$ for a choice of $n$, $h(x, a, b)$ is a polynomial, and $m$ is around $36^2$. However, I am not sure how to write intersections of polynomials in sage. How can I create a curve that is described as the intersection of two polynomials? I am especially confused because my coefficients $a$ and $b$ are not in an especially easy to code base field. Here is the code I have for counting points of plane curves, how can I adjust it to count points of this curve defined as an intersection, with coefficients in this field extension? for n in range(1, 3): x, y, z = PolynomialRing(GF(3**n), 3, 'xyz').gens() f = x^5 - x*z^4 - y^4*z C = Curve(f) print len(C.rational_points()) - (3**n+1)  2019-11-06 10:06:40 -0500 commented answer Having trouble importing the lazy_laurent_series module It's unfortunately still not working, even after importing the package you mention. I'm running SageMath version 8.1. sage: from sage.rings.laurent_series_ring import * sage: L. = LazyLaurentSeriesRing(QQ); --------------------------------------------------------------------------- NameError Traceback (most recent call last) in () ----> 1 L = LazyLaurentSeriesRing(QQ, names=('z',)); (z,) = L._first_ngens(1); NameError: name 'LazyLaurentSeriesRing' is not defined  2019-11-05 17:05:04 -0500 received badge ● Supporter (source) 2019-11-04 17:56:54 -0500 asked a question Having trouble importing the lazy_laurent_series module I am trying to import and use lazy Laurent series rings in sage, documented here: (http://doc.sagemath.org/html/en/refer...). I have the latest version of sage installed, and yet when I attempt to import/install the package it is nowhere to be found.  from sage.rings.lazy_laurent_series_ring import LazyLaurentSeriesRing --------------------------------------------------------------------------- ImportError Traceback (most recent call last) in () ----> 1 from sage.rings.lazy_laurent_series_ring import LazyLaurentSeriesRing ImportError: No module named lazy_laurent_series_ring  I then tried to download it, perhaps I am not downloading the correct package? Where is it hiding? sage -i lazy_laurent_series Error: package 'lazy_laurent_series' not found Note: if it is an old-style package, use -p instead of -i to install it  2018-11-01 08:37:40 -0500 received badge ● Nice Question (source) 2017-12-06 17:09:09 -0500 asked a question How to truncate a power series in two variables? I would like to truncate power-series by setting $y$ to 0, in order to express $y = x^3 - xy^2$ as a power series in $x$ by recursively plugging in the equation for $y$, then truncating. R. = PowerSeriesRing(QQ, default_prec = 20) f = x^3 + x*y^2 j = f(x, f(x, f(x, f(x, f(x,y))))).expand() j + O(y) --------------------------------------------------------------------------- ArithmeticError Traceback (most recent call last) in () ----> 1 j + O(y) /usr/lib/sagemath/local/lib/python2.7/site-packages/sage/rings/big_oh.py in O(*x, **kwds) 154 elif hasattr(x, 'O'): 155 return x.O(**kwds) --> 156 raise ArithmeticError("O(%s) not defined" % (x,)) ArithmeticError: O(y) not defined  I have found that other variants, such asj + O(x, y)^{31}, j.truncate(31), and j + R.O(31) also do not work. 2017-12-06 01:27:53 -0500 received badge ● Student (source) 2017-12-05 18:59:43 -0500 asked a question How can I recurse a power series in two variables? I would like very much to express, for example, R. = PowerSeriesRing(QQ, default_prec = 20) g(x, g(x, g(x, x)))  Or, f(x, f(x, f(x, f(x, f(x, f(x, f(x, f(x, f(x, f(x, f(x, f(x, (f(x, (f(x, f(x,y))))))))))))))))).expand()  In a more elegant way, for a specified number of self-compositions in one variable. I have only been able to find the sage function of composition for one variable polynomials, not for nesting two variable power series. 2017-11-22 23:38:05 -0500 asked a question How can I compose 2 power series in one variable with their compositional inverse get a power series in two variables? I would like to compose a power series $\ell$ defined in $x$ to get a power series $\ell^{-1}(\ell(x) + \ell(y))$ as a power series $f(x, y)$ in two variables, $x$ and $y$. In the code below I call l := $\ell$, and e := $\ell^{-1}$. PREC = 20 R. = PowerSeriesRing( QQ, default_prec=PREC ) f = exp( 1/3 * log( 1-x^3 ) ) print f w = 1/f l = w.integral(x) e = l.reverse() g = e(l(x) + l(y)) ??  I find immediately the following issue, let alone the issue of composing: e = l.reverse() AttributeError: 'MPowerSeriesRing_generic_with_category.element_class' object has no attribute 'reverse'  Once I have this two variable power series $f(x, y)$, I would like to output $f(x, (f(x, ..., f(x,x)))$, composed with itself $n$-times for a natural number $n$. 2017-11-22 17:25:29 -0500 commented answer How can I take a fractional power and a power series inverse? Thank you very much! I posted a follow-up question at https://ask.sagemath.org/question/39739/how-can-i-compose-2-power-series-in-one-variable-with-their-compositional-inverse-get-a-power-series-in-two-variables/ . 2017-11-22 14:36:44 -0500 asked a question How can I take a fractional power and a power series inverse? I am attempting to take the power series inverse of the Taylor series expansion of $(x^4-x)^{1/3}$ around the point 0. When I attempt to define g=(x^4-x)^{1/3} : sage: R. = LaurentPolynomialRing(QQ); sage: g = (x^4-x)^{1/3} --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 g = (x**Integer(4)-x)**{Integer(1)/Integer(3)} sage/rings/polynomial/laurent_polynomial.pyx in sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_univariate.__pow__ (/usr/lib/sagemath//src/build/cythonized/sage/rings/polynomial/laurent_polynomial.c:10802)() TypeError: int() argument must be a string or a number, not 'set'  Now, when I define $g$ as follows, I am unable to take the power series inverse: sage: var('x') x sage: g = (1-x)**(1/3) sage: G = g.taylor(x, 0, 10) sage: 1/G -4782969/(55913*x^10 + 64515*x^9 + 75735*x^8 + 90882*x^7 + 112266*x^6 + 144342*x^5 + 196830*x^4 + 295245*x^3 + 531441*x^2 + 1594323*x - 4782969) sage: 1/G + O(x^10) --------------------------------------------------------------------------- ArithmeticError Traceback (most recent call last) in () ----> 1 Integer(1)/G + O(x**Integer(10)) /usr/lib/sagemath/local/lib/python2.7/site-packages/sage/rings/big_oh.py in O(*x, **kwds) 154 elif hasattr(x, 'O'): 155 return x.O(**kwds) --> 156 raise ArithmeticError("O(%s) not defined" % (x,)) ArithmeticError: O(x^10) not defined sage: G.inverse() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in ()  How can I have the best of both worlds? In the end, I would like to have an element in the Laurent Series Ring, for the next stage is to take the formal integral of the result, and the composition inverse of this formal integral. 2017-11-21 17:04:45 -0500 commented answer How do I code a Laurent Series with variable coefficients? Thank you very much, your edit was a lifesaver, and now everything works! 2017-11-21 17:04:30 -0500 received badge ● Scholar (source) 2017-11-21 17:04:27 -0500 received badge ● Editor (source) 2017-11-20 01:41:50 -0500 commented answer How do I code a Laurent Series with variable coefficients? I am attempting to expand as a power series a quotient with variable coefficients. With this formalism, I am still unable to expand the polynomial quotient I receive (for my more complicated quotient, still in a and t) by adding + O(t^5). 2017-11-19 15:08:50 -0500 asked a question How do I code a Laurent Series with variable coefficients? Edit: Adding more context. I am attempting the following procedure: Begin with a polynomial $Z(u)$ with variable coefficients, of the form $1 + au + bu^2 + cu^3 + pbu^4 + p^2au^5 + p^3u^6$. Examine the coefficients of $Z'(u)/Z(u)$ as a power series in $u$. It is this quest which leads me to attempt to construct a LaurentSeriesRing with variable coefficients. However, I keep encountering TypeErrors, I am wondering if a kind soul could help me in my quest. I will use here a very simple polynomial f to get the point across. I am attempting to construct a LaurentSeriesRing with variable coefficients. However, I keep encountering TypeErrors, I am wondering if a kind soul could help me in my quest. I will use here a very simple polynomial f to get the point across. sage: R. = LaurentSeriesRing(QQ, 't') sage: var('a') a sage: f = 1 + a*t --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 f = Integer(1) + a*t sage/structure/element.pyx in sage.structure.element.Element.__mul__ (/usr/lib/sagemath//src/build/cythonized/sage/structure/element.c:12443)() sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/usr/lib/sagemath//src/build/cythonized/sage/structure/coerce.c:10496)() TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and 'Laurent Series Ring in t over Rational Field'  I also tried: sage: R. = QQ[] sage: var('a') a sage: f = 1 + a*u sage: ff = derivative(f, u) sage: R. = LaurentSeriesRing(QQ); R sage: f/ff + O(u^5) ---------------------- TypeError Traceback (most recent call last) in () ----> 1 f/ff + O(u**Integer(5)) sage/structure/element.pyx in sage.structure.element.Element.__add__ (/usr/lib/sagemath//src/build/cythonized/sage/structure/element.c:11198)() sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (/usr/lib/sagemath//src/build/cythonized/sage/structure/coerce.c:10496)() TypeError: unsupported operand parent(s) for '+': 'Symbolic Ring' and 'Laurent Series Ring in u over Rational Field'