Rather than use a series expansion, you might treat this as a parametric ODE and use ParametricNDSolve
. Here of course y
is the parameter, as it does not appear in the derivatives. I just solve from x=0
to x=2
.
psol = ParametricNDSolveValue[{D[f[x], x] + f[x]^2 ==
Sin[x + y]*Cos[x]*Cos[2*y], f[0] == 0}, f[x], {x, 0, 2}, y];
Define an evaluation function.
pvalue[x0_, y0_] := psol[y0] /. x -> x0
I'll show this for a fairly modest range.
xmax = 1;
ymax = .7;
p1 = Plot3D[pvalue[x, y], {x, 0, xmax}, {y, 0., ymax}]
To compare to the series solution proposed by @bgodfrey we can do as follows.
pxy = x^2/2 - x^4/6 + x y - x^3 y/3 - x^4 y/4 - 5 x^2 y^2/4 -
x^3 y^2/3 + 5 x^4 y^2/12 - 13 x y^3/6 + 13 x^3 y^3/18 +
7 x^4 y^3/6 + 41 x^2 y^4/48 + 13 x^3 y^4/9 - 41 x^4 y^4/144;
p2 = Plot3D[pxy, {x, 0, xmax}, {y, 0., ymax}]
One can see these are close for a while but start to disagree, somewhat violently, in one corner (could use Show[{p1,p2}]
to see it in more detail).
I should add that this method too will have its limitations-- the plot really does get wild beyond y=1.2
or so. I do not know if it's intrinsic to the problem or rather a limitation in the capabilities of ParametricNDSolve
. Some experimenting also suggests it has no issue with y<0
until somewhere past y=-4.5
.
Series
to expand theD[f[x,y],x]+f[x,y]^2-V[x,y]
about{0, 0}
andSolve
for the coefficients. $\endgroup$n
. $\endgroup$