DSolve[{Laplacian[u[x, y],{x, y}] == x y, 
  DirichletCondition[u[x, y] == x y, True]}, 
 u[x, y], {x, y} \[Element] Disk[{0, 0}, 1]]

This is the code I used to solve this equation; But it does not evaluate and just outputs what I inputted... It's sure that it's not a Dirichlet problem but I don't know how to modify it.


1 Answer 1


I never use region thing with DSolve. It does not look like it works with DSolve but only with NDSolve. So as a workaround, you could do the following

ClearAll[x, y, u, r, theta]
rhs = r^2 Cos[theta]*Sin[theta];
pde = Laplacian[u[r, theta], {r, theta}, "Polar"] == rhs;
bc = u[1, theta] == Cos[theta]*Sin[theta];
soldsolve = u[r, theta] /. First@DSolve[{pde, bc}, u[r, theta], {r, theta}]

Mathematica graphics

To plot

ParametricPlot3D[{r Cos[theta], r Sin[theta], soldsolve}, {r, 0, 
  1}, {theta, 0, 2*Pi}, AxesLabel -> {"x", "y", "u"}, BaseStyle -> 15,
  ImageMargins -> 5, PerformanceGoal -> "Quality", 
 BoxRatios -> {1, 1, 1/2}]

Mathematica graphics

Compare the solution to numerical solution

ClearAll[x, y, u];
pde = Laplacian[u[x, y], {x, y}] == x y;
bc = DirichletCondition[u[x, y] == x y, True];
solNdsolve = NDSolve[{pde, bc}, u, Element[{x, y}, Disk[{0, 0}, 1]]]

Mathematica graphics

Plot3D[Evaluate[u[x, y] /. solNdsolve],  Element[{x, y}, Disk[{0, 0}, 1]]]

Mathematica graphics

Pick a random position to verify against numerical solution:

soldsolve /. {r -> Sqrt[1/4 + 1/4], theta -> Pi/4} // N
(* 0.239583 *)

Evaluate[u[1/2, 1/2] /. solNdsolve]
(* {0.239578} *)
  • $\begingroup$ Thanks for your answer. I find that DSolve can work out laplace's equation with boundary condition in that way, which bothers me even more... anyway, I have learned much from your detailed answer, thanks again. $\endgroup$
    – pei
    Commented Jul 6, 2021 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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