# DSolve solution for 1st order PDE involving complex number does not match initial condition

Bug introduced in 11.3 or earlier, persisting through 13.2.1.

[Mathematica 12.0.0.0, MacOS X x86 (64bit)]

Trying to solve

ClearAll["Global*"];
DSolveValue[
D[F[a, t], t] == 2 I a F[a, t] + 2 (a + 2 I a^2) D[F[a, t], a] &&
F[a, 0] == E^(I a Q), F[a, t], {a, t}] // FullSimplify


returns

(E^((a E^(2 t) Q)/(I - 2 a (1 + E^(2 t)))) Sqrt[(
1 + 2 I a)/(-I + 2 a (1 + E^(2 t)))])/Sqrt[I - 2 a]


For $$t=0$$ this evaluates to $$\frac{\sqrt{\frac{1+2 i a}{4a-i}}e^{\frac{a Q}{i-4a}}}{\sqrt{i-2a}}$$

which does not match the initial condition $$F[a,0]=e^{i a Q}$$.

Any idea where the problem lies?

• I will delete my answer to check it again later. It does satisfy the IC, but can't make it satisfy the pde itself and I do not see why now, while Mathematica solution satisfies the pde but not the IC. So I might have something wrong in my solution since it only satisfies the IC. Will look at it again later if I can. Commented Feb 26, 2023 at 18:11
• Ok, thank you very much! Commented Feb 26, 2023 at 19:43
• Are there any conditions on a and t? For instance, are they both non-negative real numbers? Commented Feb 28, 2023 at 20:38
• Same behavior in v13.2. The sample can be simplified a bit to: DSolveValue[{D[F[a, t], t] == a (1 + I a) D[F[a, t], a], F[a, 0] == a}, F[a, t], {a, t}] // FullSimplify Commented Mar 1, 2023 at 3:55
• @AlephBeth please report and raise this bug issue with [email protected] Commented Mar 1, 2023 at 14:12

This interesting question can be answered as follows. First, obtain the solution without an initial condition.

DSolveValue[D[F[a, t], t] == 2 I a F[a, t] + 2 (a + 2 I a^2) D[F[a, t], a],
F[a, t], {a, t}]
(* C[1][1/4 (4 t - 2 I ArcTan[2 a] + 2 Log[a] - Log[1 + 4 a^2])]/Sqrt[I - 2 a] *)


Not surprisingly, DSolve has used the Method of Characteristics to obtain this answer. See the Introduction to Symbolic Solutions to PDEs. The solution is given by constant values along characteristics:

cn = Numerator[%][[1]]
(* 1/4 (4 t - 2 I ArcTan[2 a] + 2 Log[a] - Log[1 + 4 a^2]) *)


divided by Sqrt[I - 2 a]. So, to obtain the solution for any {a, t}, trace back along the corresponding characteristic to t = 0, find the value there, and divide it by Sqrt[I - 2 a]. To relate (a, t} to {a0, 0}, solve

Solve[cn == (cn /. t -> 0 /. a -> a0), a0] // FullSimplify // Flatten
(* {a0 -> (a E^t)/((-1 - 4 I a) Cosh[t] + Sinh[t]),
a0 -> (a E^t)/(Cosh[t] + (-1 - 4 I a) Sinh[t])} *)


The first expression leads to the incorrect result identified in the question. The second expression, however, leads to the correct result.

sol = Exp[I Q a0] Sqrt[I - 2 a0]/Sqrt[I - 2 a] /. %[[2]]
(* (E^((I a E^t Q)/(Cosh[t] + (-1 - 4 I a) Sinh[t]))
Sqrt[I - (2 a E^t)/(Cosh[t] + (-1 - 4 I a) Sinh[t])])/Sqrt[I - 2 a] *)


That this result is correct can be verified by

FullSimplify[Unevaluated[{D[F[a, t], t] ==
2 I a F[a, t] + 2 (a + 2 I a^2) D[F[a, t], a], F[a, 0] == E^(I a Q)}]
/. {F[a, t] -> sol, F[a, 0] -> (sol /. t -> 0)}]
(* {True, True} *)


I suspect that DSolve obtained the incorrect result in the question, because it did not handle branch cuts in the complex plane correctly. By the way, in the course of investigating this problem, I obtained a simpler but equivalent solution,

Sqrt[I - ((2*I)*a*E^(2*t))/(I - 2*a + 2*a*E^(2*t))]/
E^((a*E^(2*t)*Q)/(I - 2*a + 2*a*E^(2*t)))/Sqrt[I - 2 a]]
`

The derivation is a bit long.

• Thank you very much for your answer. I suspected this was a bug, but it is good to have some more experienced Mathematica user check it. Commented Mar 1, 2023 at 17:20