I make a approximate solution of the differential equations. But when I use the rule for one, and it can work. But when using a list of rules, It cannot. I mean "(Sum[ep^k*Subscript[y, k], {k, 0, n - 1}] /. First@s1)[x]" cannot caculate.(The last line cannot work, the line before the last line can work) Could you help me please? Thanks a lot.
Clear["`*"]
f := ((1 + #3)*#2^2 + 1) &
n = 3;
s = CoefficientList[Collect[D[Series[y[x, ep], {ep, 0, n}], x] -
Series[f[x, y[x, ep], ep], {ep, 0, n}], ep], ep] // Simplify;
s = s /. {
\!\(\*SuperscriptBox[\(y\),
TagBox[
RowBox[{"(",
RowBox[{"j_", ",", "i_"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, 0] :> D[Subscript[y, i][x], {x, j}],
y[x, 0] :> Subscript[y, 0][x]};
s1 = DSolve[{s[[1]] == 0, s[[2]] == 0, s[[3]] == 0,
Subscript[y, 0][0] == 0, Subscript[y, 1][0] == 0,
Subscript[y, 2][0] == 0}, {Subscript[y, 0], Subscript[y, 1],
Subscript[y, 2]}, x];
a = (Subscript[y, 0] /. s1[[1, 1]])[x]
(Sum[ep^k*Subscript[y, k], {k, 0, n - 1}] /. First@s1)[x]