4
$\begingroup$

How do I solve a differential equation when one of the arguments requires that the value of one variable is equal to the value of the other variable, when I try this I get this error:

"DSolve::conarg: The arguments should be ordered consistently." for input

e = {Derivative[2, 0][u][x, y] + Derivative[0, 2][u][x, y] == 4, 
  u[x, x] == 2 x^2,  
  Derivative[1, 0][u][x, x] == 2 x}
s = DSolve[e, u, {x, y}]

The solution should be like x^2 + y^2

$\endgroup$
  • 1
    $\begingroup$ I've edited the question to highlight the specific problem. $\endgroup$ – Feyre Dec 13 '16 at 15:50
7
$\begingroup$

DSolve is unable to solve this problem without assistance. Begin by solving the PDE only,

s = DSolveValue[D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}] == 4, u[x, y], {x, y}] 
    /. {C[1] -> c1, C[2] -> c2}
(* 2 x^2 + c1[I x + y] + c2[-I x + y] *)

and then apply the two auxiliary conditions.

b1 = Simplify[(s /. y -> x) == 2 x^2]
(* c1[(1 + I) x] + c2[(1 - I) x] == 0 *)
b2 = Simplify[(D[s, x]) == 2 x] /. y -> x
(* 2 x + I Derivative[1][c1][(1 + I) x] - I Derivative[1][c2][(1 - I) x] == 0 *)

These two expressions then can be solved to obtain

Flatten@Solve[{D[b1, x], b2}, {Derivative[1][c1][(1 + I) x], Derivative[1][c2][(1 - I) x]}]
(* {Derivative[1][c1][(1 + I) x] -> (1 + I) x, Derivative[1][c2][(1 - I) x] -> (1 - I) x}*)

Although these two relations can be integrated with Mathematica to obtain c1 and c2, the solutions are obvious.

{(c1[(1 + I) x] -> ((1 + I) x)^2/2 + c11), (c2[(1 - I) x] -> ((1 - I) x)^2/2 + c22)}

where c11 and c22 are constants. Next, replace (1 + I) x by (y + I x) and (1 - I) x by (y - I x).

ss = {(c1[(1 + I) x] -> ((1 + I) x)^2/2 + c11) /. x -> (y + I x)/(1 + I), 
      (c2[(1 - I) x] -> ((1 - I) x)^2/2 + c22) /. x -> (y - I x)/(1 - I)}

Finally, c11 and c22 are determined by

b1 /. (ss /. y -> x) /. Equal -> Rule
(* c11 + c22 -> 0 *)

Simplify[s /. ss] /. %
(* x^2 + y^2 *)

A lengthy process to obtain a simple answer.

Alternative Approach

The auxiliary conditions imposed on the PDE are, in effect, initial conditions on the line x - y == 0. Consequently, changing coordinates so that these initial conditions lie on a coordinate line, say a == 0 seemed productive. The transformation can be accomplished simply, using Kuba's function, DChange.

eq = DChange[D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}] == 4, 
    {a == x - y, b == x + y}, {x, y}, {a, b}, {u[x, y]}] /. u -> v
(* Derivative[0, 2][v][a, b] + Derivative[2, 0][v][a, b] == 2 *)

Since the inverse transform is given by

Flatten@Solve[{a == x - y, b == x + y}, {x, y}]
(* {x -> (a + b)/2, y -> 1/2 (-a + b)} *)

the auxiliary conditions become

eqb1 = (v[a, b] == 2 x^2) /. % /. a -> 0
(* v[0, b] == b^2/2 *)
eqb2 = DChange[Derivative[1, 0][u][x, y] == 2 x, {a == x - y, b == x + y}, 
    {x, y}, {a, b}, {u[x, y]}] /. u -> v /. a -> 0
(* b == Derivative[0, 1][v][0, b] + Derivative[1, 0][v][0, b] *)

given, as desired, at a == 0. Unfortunately,

DSolveValue[{eq, eqb1, eqb2}, v[a, b], {a, b}]

returns unevaluated. Thus, we are again left with solving

s = DSolveValue[{eq}, v[a, b], {a, b}] /. {C[1] -> c1, C[2] -> c2}
(* a^2 + c1[I a + b] + c2[-I a + b] *)

and nothing has been gained from the transformation. For completeness, the solution proceeds as follows.

b1 = Simplify[(s /. a -> 0) == b^2/2];
b2 = Simplify[D[s, a] + D[s, b] == (a + b)] /. a -> 0;
Flatten@Solve[{D[b1, b], b2}, {Derivative[1][c1][b], Derivative[1][c2][b]}]
(* {Derivative[1][c1][b] -> b/2, Derivative[1][c2][b] -> b/2} *)
ss = {(c1[b] -> b^2/4 + c11) /. b -> b + I a, (c2[b] -> b^2/4 + c22) /. b -> b - I a}
(* {c1[I a + b] -> 1/4 (I a + b)^2 + c11, c2[-I a + b] -> 1/4 (-I a + b)^2 + c22} *)
Simplify[b1 /. (ss /. a -> 0)] /. Equal -> Rule;
Simplify[s /. ss] /. %
(* 1/2 (a^2 + b^2) *)

which is equivalent to the result obtained earlier.

Simplify[% /. {a -> x - y, b -> x + y}]
(* x^2 + y^2 *)
$\endgroup$
  • 1
    $\begingroup$ This is definitely a blind-spot in the function. I thought about doing it like this, but was convinced someone would know a simpler solution. $\endgroup$ – Feyre Dec 13 '16 at 20:51

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.