# Getting equations from asymptotic expansion

I want to solve the equation by means of asymptotic expansion. After having defined the equation and the series:

eq1 = u[x] == 1 + ϵ u[x]^3;
w[x_, ϵ_] = 1 + ϵ Subscript[u, 1][x] + ϵ^2 Subscript[u, 2][x] + ϵ^3 Subscript[u, 3][x];
eq1exp = eq1 /. u[x] -> w[x, ϵ]


I have to get a set of equations for each degree of the small paramater $\varepsilon$. How can I get the list of equations mentioned?

Update

In version M12 you can use the new function AsymptoticSolve to do all the work:

AsymptoticSolve[u == 1 + ϵ u^3, u, {ϵ, 0, 3}] //TeXForm


$$\left\{\left\{u\to 12 \epsilon ^3+3 \epsilon ^2+\epsilon +1\right\},\left\{u\to \frac{105 \epsilon ^{3/2}}{128}-\frac{3 \epsilon ^2}{2}-\frac{\epsilon }{2}+\frac{3 \sqrt{\epsilon }}{8}-\frac{1}{\sqrt{\epsilon }}-\frac{1}{2}\right\},\left\{u\to -\frac{105 \epsilon ^{3/2}}{128}-\frac{3 \epsilon ^2}{2}-\frac{\epsilon }{2}-\frac{3 \sqrt{\epsilon }}{8}+\frac{1}{\sqrt{\epsilon }}-\frac{1}{2}\right\}\right\}$$

Something like:

SolveAlways[Normal @ Series[eq1exp, {ϵ, 0, 3}], ϵ]


{{Subscript[u, 3][x] -> 12, Subscript[u, 2][x] -> 3, Subscript[u, 1][x] -> 1}}

perhaps?

For just the equations you can use one of the following:

Thread[Series[eq1exp,{ϵ, 0, 3}][[All, 3]]]
Thread[CoefficientList[#, ϵ]& /@ Series[eq1exp, {ϵ, 0, 3}]]


{True, Subscript[u, 1][x] == 1, Subscript[u, 2][x] == 3 Subscript[u, 1][x], Subscript[u, 3][x] == 3 (Subscript[u, 1][x]^2 + Subscript[u, 2][x])}

{True, Subscript[u, 1][x] == 1, Subscript[u, 2][x] == 3 Subscript[u, 1][x], Subscript[u, 3][x] == 3 (Subscript[u, 1][x]^2 + Subscript[u, 2][x])}

• This solution is perfectly suited to this example. But in case of differential equations it seems that a command like DSolveAlways doesn't exists. Could I get just a list of equations I would be able to solve it. Jun 23, 2017 at 19:04
• @ArtemZefirov See update. Jun 23, 2017 at 22:16
• The second variant is what I need. Thanks. Jun 24, 2017 at 7:22
• Could you modify your last answer, which I've accepted, in order to make it work with equations like u[x]- ϵ u[x]^3 == 1 The current command returns "False" because of the right part of the equation has only one coefficient in expansion but not three. Jul 1, 2017 at 16:41

CoefficientArrays[eq1exp, ϵ] returns the list of required coefficients.