1
$\begingroup$

I'm trying to get the general solution for the Laplace equation: $\frac{\partial^2 V}{\partial x^2} + \frac{\partial^2 V}{\partial y^2} = 0$ on the domain $\mathbb{R_0}\times\mathbb{R^+}\backslash\{(0,0)\}$ with the following boundary conditions: $V(x,0) = 0$ if $x>0$ and $V(x,0) = \pi$ if $x<0$.

Here is my code:

pde = D[V[x,y],{x,2}] + D[V[x,y],{y,2}] == 0
ic = {V[x > 0,0] == 0, V[x < 0,0] == Pi}
sol = Refine[DSolve[{pde,ic}, {V[x, y]}, {x, y}],{x,y} != {0,0} && y >= 0]

But I am not getting anything (the output is just showing the input with no solving whatsoever). Also, if I try to plot it I get the following error message: "... is neither a list of replacement rules nor a valid dispatch table and so cannot be used for replacing. "

What am I doing wrong ?

(I am very new to mathematica so I apologize if the answer is obvious)

$\endgroup$

1 Answer 1

3
$\begingroup$
Clear["Global`*"]

pde = D[V[x, y], {x, 2}] + D[V[x, y], {y, 2}] == 0;
ic = V[x, 0] == Piecewise[{{Pi, x < 0}}];
sol = Assuming[y >= 0, 
  DSolve[{pde, ic}, V[x, y], {x, y}][[1]] // Simplify]

enter image description here

Activate[
  Inactive[D][V[x, y], {x, 2}] + Inactive[D][V[x, y], {y, 2}] == 0 /. 
   sol] // Simplify

(* True *)

Plot3D[V[x, y] /. sol, {x, -1, 2}, {y, 0, 2},
 AxesLabel -> (Style[#, 14] & /@ {x, y}),
 PlotPoints -> 100]

enter image description here

$\endgroup$
6
  • $\begingroup$ Thank you very much! Could you just let me know which part makes $V(x,0) = 0$ if $x>0$ ? And how could I solve the same PDE with other boundary conditions ? $\endgroup$
    – c.leblanc
    Dec 11, 2022 at 12:59
  • $\begingroup$ The documentation for Piecewise says that when none of the predicates are true, the value defaults to zero. $\endgroup$ Dec 11, 2022 at 13:24
  • $\begingroup$ Which brings to my second question, how could I solve the same PDE with other boundary conditions ? (non zero) $\endgroup$
    – c.leblanc
    Dec 12, 2022 at 23:39
  • $\begingroup$ @c.leblanc - post a new question showing what you have tried and explain what problems you are having. $\endgroup$
    – Bob Hanlon
    Dec 13, 2022 at 0:41
  • $\begingroup$ Thanks to your help, I don't have a problem on this one anymore. I just would like to understand (in general), how to write 2 boundary conditions (ie: of any value, not only a second one that is equal to zero if the other is not true) $\endgroup$
    – c.leblanc
    Dec 16, 2022 at 21:08

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.