# Why does this partial differential solution not work?

Here I am trying to solve a simple partial differential equation i.e. $\frac{\partial^2f}{\partial x^2}+\frac{\partial^2f}{\partial y^2}=6y$ but for some reason it won't solve it. There clearly is a solution as shown in the bottom and the code gives me a perfectly valid solution if I replace 6y with 0. Any thoughts?

• This is an elliptic PDE and it as infinitely many solutions. You need some boundary conditions or something the like to make the solution unique. – Henrik Schumacher Jan 10 '18 at 14:49
• how can I tell mathematica to only give me polynomial solutions? – Aakash Lakshmanan Jan 10 '18 at 14:54
• Make an ansatz and compare coefficients. See, e.g., CoefficientRules. – Henrik Schumacher Jan 10 '18 at 14:56
• What is an ansatz? – Aakash Lakshmanan Jan 10 '18 at 15:11
• en.wikipedia.org/wiki/Ansatz – Chris K Jan 10 '18 at 16:38

n = 3;
coeffs = Flatten[Table[c[i, j], {i, 0, n}, {j, 0, n}]];
ansatz = Sum[c[i, j] x^i y^j, {i, 0, n}, {j, 0, n}];
result = ansatz /.
Solve[Flatten[
CoefficientList[
D[ansatz, x, x] + D[ansatz, y, y] - y, {x, y}]] == 0,
coeffs][[1]]


c[0, 0] + y c[0, 1] - x^2 c[0, 2] + y^2 c[0, 2] + x^2 y (1/2 - 3 c[0, 3]) + y^3 c[0, 3] + x c[1, 0] + x y c[1, 1] - 1/3 x^3 c[1, 2] + x y^2 c[1, 2] - x^3 y c[1, 3] + x y^3 c[1, 3]

A test:

D[result, x, x] + D[result, y, y] // Simplify


y

You see, there are plenty solutions...

Mathematica can solve this pde :

DSolve[Derivative[2, 0][g][x, y] + Derivative[0, 2][g][x, y] ==0, g, {x, y}]
(* {{g -> Function[{x, y}, C[1][I x + y] + C[2][-I x + y]]}} *)


The solution of your problem is f[x,y]=g[x,y]+y^3 !

• Yes, I noted this in my question as well. – Aakash Lakshmanan Jan 10 '18 at 15:14