# Numerically approximating the series of the solution to a PDE

Suppose I had a PDE such as the heat equation in two variables, and I want to solve it with mathematica, and ask it to return me a series expansion of the solution. For example,

fsoln = NDSolve[{D[f[x,y],x]+D[f[x,y],y,y]==0,f[0,y]==1,f[x,0]==x+1},f,{x,0,10},{y,0,10}]


This returns fsoln as an interpolating function. If I wanted to get a series expansion to say $$x^{10}$$ while keeping $$y$$ constant and $$y=1$$, I use

Series[Evaluate[f[x,1]/.fsoln],{x,0,10}]


which gives me the output 1+O(x)^11. This is clearly wrong, since the solution to the heat equation is not a constant! How can this problem be solved?

From a comment in this question I tried to use

Method -> {"FixedStep", Method -> {"ImplicitRungeKutta", "DifferenceOrder" -> 5}


but it does not seem to help to increase the number of terms (the coefficients of $$x^4$$ and above terms seem to always be $$0$$).

Try

F = NDSolveValue[{D[f[x, y], x] + D[f[x, y], y] == 0, f[0, y] == 1, f[x, 0] == x + 1}, f, {x, 0, 10}, {y, 0, 10}]


which gives the interpolation F[x,y]

Fs=Series[F[x, 1], {x, 0, 10}]//Normal
(*1. - 2.68882*10^-17 x - 0.263942 x^2 + 3.02651 x^3*)


evaluates a cubic series approximation (O[x^11])!

Fser = Series[F[x, 1], {x, 0, 10}] // Normal;
Plot[{F[x, 1], Max[1, x], Fser}, {x, 0, 10}, PlotRange -> {0, 10}]


which fits only for small x!

• That's better, but surely the solution to the heat equation isn't a cubic polynomial! It is not even a polynomial at all, so shouldn't we expect to see $x^4,x^5,\dots,x^{10}$ terms as well? – YiFan Jun 4 at 8:41
• I would expect a piecewise linear solution, but I didn't check your model! – Ulrich Neumann Jun 4 at 8:47
• I think the issue here, as explained by one of the answers in the linked question, is that NDSolve only gives interpolating function solutions with fourth order derivatives equal to $0$. The correct solution is certainly not piecewise linear or cubic. – YiFan Jun 4 at 8:49
• The equation D[f[x, y], x] + D[f[x, y], y] == 0does not look like the heat equation. The letter is second order. – Alexei Boulbitch Jun 4 at 9:06
• @AlexeiBoulbitch Of course, there was a typo in the question. It is fixed now. – YiFan Jun 4 at 20:40