# Revision history [back]

### 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.<x, y> = 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)
<ipython-input-20-fe9380f2a091> in <module>()
----> 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.