Is it possible, when using DSolve to solve a partial differential equation, to specify the value of the solution in a finite domain? For example, to find the function $\phi(x_1,x_2)$, (with $x_1,x_2 \in \mathbb{R}$) that satisfies the equation

$-i(\partial_{x_1} + \partial_{x_2}) \phi(x_1,x_2) = A \phi(x_1,x_2) $,

with the condition that $\phi(x_1,x_2) = f(x_1,x_2)$ in the third quadrant, i.e. for $x_1,x_2<0$.

$f(x_1,x_2)$ is a known function and $A$ is just a parameter.

  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Commented Nov 12, 2017 at 14:53

1 Answer 1


In all but the third quadrant, ϕ satisfies

s = DSolveValue[-I (D[ϕ[x1, x2], x1] + D[ϕ[x1, x2], x2]) == 
        a ϕ[x1, x2], ϕ[x1, x2], {x1, x2}]
(* E^(I a x1) C[1][-x1 + x2] *)

where C[1] is an arbitrary function of x2 - x1. Boundary conditions are applied at the edges of the third quadrant,

(s /. x1 -> 0) == f[0, x2] (* x2 < 0 *)
(* C[1][x2] == f[0, x2] *)

(s /. x2 -> 0) == f[x1, 0] (* x1 < 0 *)
(* E^(I a x1) C[1][-x1] == f[x1, 0] *)

It follows, therefore, that C[1] is given by

C[1][x2-x1] -> Piecewise[{{Exp[I a (x2 - x1)] f[x1 - x2, 0], x2 - x1 > 0}, 
    {f[0, x2 - x1], x2 - x1 < 0}}]

and ϕ is given by

Piecewise[{{E^(I*a*x2)*f[x1 - x2, 0], x1 < x2}, {E^(I*a*x1)*f[0, -x1 + x2], x1 > x2}}, 0]

The validity of this expression can be verified by inserting it into the PDE and the two boundary conditions given above.

To illustrate the solution, consider

f[x_, y_] := x + y

designate the solution given above by ss, substitute a -> 1, and set the solution to f[x1, x2] in the third quadrant. Then,

Plot3D[Evaluate[ReIm[Piecewise[{{f[x1, x2], x1 < 0 && x2 < 0}}, ss /. a -> 1]]], 
    {x1, -1, 1}, {x2, -1, 1}, AxesLabel -> {x1, x2, ϕ}, Exclusions -> None, 
    PlotPoints -> 50, LabelStyle -> Directive[Bold, Black, Medium], ImageSize -> Large]

enter image description here

where the real part of the solution is in orange, and the imaginary part in blue. Visibly the solution is continuous everywhere. Its first derivative need not be continuous, however, because the PDE is only first-order.

  • $\begingroup$ Thanks for the answer! It's very clear and helpful! $\endgroup$ Commented Nov 15, 2017 at 21:10

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.