# An analog to Pari's serlaplace

With PARI I can do this:

```
f(x) = ((3*x + 8)*sinh(2*x) + (2*x^2 + 16*(x + 1))*cosh(2*x))/16;
serlaplace(f('x + O('x^5)))
```

PARI returns 1 + 2*x + 5*x^2 + 16*x^3 + 28*x^4 + O(x^5).

How to achieve this with Sage? Note that I want the returned value to live in the 'Power Series Ring' over the 'Integer Ring'.

```
def serlaplace(f, prec):
t = taylor(f, x, 0, prec)
C = [c[0] for c in t.coefficients()]
R.<u> = PowerSeriesRing(QQ)
S.<z> = PowerSeriesRing(ZZ)
return S(R(C).egf_to_ogf())
f(x) = ((3*x + 8)*sinh(2*x) + (2*x^2 + 16*(x + 1))*cosh(2*x))/16
serlaplace(f, 4) returns 1 + 2*z + 5*z^2 + 16*z^3 + 28*z^4.
```

The question is: Is there a more direct, more efficient way to achieve this?