# How can I recurse a power series in two variables?

I would like very much to express, for example,

```
R.<x, y> = 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.

Could you provide a definition of

`f`

and`g`

that one could use to explore your question?Note: with

`R`

as in the question,`R.random_element()`

gave a starting point for exploration.In general though, providing a working example helps other Ask Sage users to explore a question. This question had

`g(x, g(x, g(x, x)))`

but no definition of`g`

to make that work.