# Want to create a generic series with indexed coeffs, e.g. a[1], a[2],...

Hello, I'm very new to Sage and would like to take a horrible equation, $H(e^v,z)=0$, and substitute into $v$ a power series, like $v(z)=\sum_{i=l}^{u} a[i] z^i, $ where maybe $l<0$. I'd then like to solve for the coefficients, at each power of $z$, or all at once like Mathematica does (or so I'm told). The Mathematica version is here in case it helps clear up my question.

```
ord = 10;
eq2 = (-(1 - Exp[v])*Exp[2*(z^2 + Log[-Sqrt[3]] + 2*Log[3]) + 9*v]) -
3^(5/2)*(9*Exp[4*v] - 3*Exp[3*v] - 4*Exp[2*v] - Exp[v] + 1)*
Exp[z^2 + 3*v] - 3*Exp[v] + 1
VV = Series[Sum[a[i] z^i, {i, 0, $ord}], {z, 0, $ord}]
a[0] = (-1/2)*Log[3]
ef2 = Block[{$MaxExtraPrecision=1000},Solve[Series[(eq2 /. v -> VV), {z, 0, $ord}] == 0,
Table[a[i], {i, 1, $ord}]]//FullSimplify]
VV/.ef2
```

Everything is complex and I was thinking of something like this pseudo-script:

```
M.<v,z> = AsymptoticRing(growth_group='exp(v^CC)*exp(z^CC)*CC',coefficient_ring=CC); M
t = M.gens()
f = sum(t[n]*z^n for n in range(8))
eq = e^(4*v+3*z)+...;
eq.substitute(v=f)
eqZ1 = eq.solve(z)
eqZ2 = eq.solve
```

But this is very scattered, rough, and not even meaningful. I'm not sure if using this 'experimental' AsymptoticRing is a good idea, nor if my growth group is correct. I also see things like .substitute, etc. from the /ref/Calculus.

All I really want to do is take a generic expression $$H = \sum_i e^{a_i*v + b_i*z^2}=0,$$ where $a_i$ and $b_i$ are complex, and replace the $v$ with $\sum_{i=low}^{i=high} h_i z^i$ -- actually I am working on 'eq2', of several, in the first Mathematica block. Then take Taylor series and solve for the coefficients $a_i$ in ascending powers of $z$. This is much like Hinch's book, Perturbation Methods, in the very beginning, for "expansion methods".

Thank you for your time and help!

I do not quite understand your subtitution $v_i$ by $\sum_{i=low}^{i=high} h_i z^i$. The left term has $i$ has an index and you replaced it by something which uses $i$ as an index of sumation.

Ahh you'r right, I was conflating two things. I'll fix it, Thanks