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


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$).



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}]

enter image description here

which fits only for small x!

  • $\begingroup$ 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? $\endgroup$ – YiFan Jun 4 '19 at 8:41
  • $\begingroup$ I would expect a piecewise linear solution, but I didn't check your model! $\endgroup$ – Ulrich Neumann Jun 4 '19 at 8:47
  • $\begingroup$ 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. $\endgroup$ – YiFan Jun 4 '19 at 8:49
  • 2
    $\begingroup$ The equation D[f[x, y], x] + D[f[x, y], y] == 0does not look like the heat equation. The letter is second order. $\endgroup$ – Alexei Boulbitch Jun 4 '19 at 9:06
  • $\begingroup$ @AlexeiBoulbitch Of course, there was a typo in the question. It is fixed now. $\endgroup$ – YiFan Jun 4 '19 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.