1

My goal is to use NDSolve to solve the complex pde $F(z,t)$ with complex derivative $\partial_{z}=\frac{1}{2}(\partial_{x}-i \partial_{y}).$ The equation can be solved by DSolve:

pde = I*D[F[z, t], t] -z*D[F[z, t], z] == 0
sol = DSolve[pde, F[z, t], {z, t}]
pde = I*D[F[z, t], t] -z*D[F[z, t], z] == 0
sol = DSolve[{pde, F[z, 0] == Exp[z]}, F[z, t], {z, t}]

image of code above and solution returned by DSolve

One can see the solution is $F(z,t)=e^{-e^{it}z}$.

In the future, however, I will have more complicated cases on which DSolve may fail, so I want to solve it using NDSolve as well. I change $z=x+iy$ and implement the complex derivative, but it fails and the function looks incorrect: NDSolve returns warnings on missing boundary conditions and failed error tolerance check

I think this is because I didn't specify the boundary conditions for the grid, but how can I know it? I expected that the condition $F(x,y,0)=F(z,0)=e^{z}$ would have been enough, as it was for DSolve. How can solve this issue?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
En-Jui Kuo
  • 11
  • 2
  • The question is unclear to me. Why replace z by x + I y? If you do need to make this substitution, write F as F[x + I y, t]`. – bbgodfrey Jun 15 '22 at 01:48
  • I just copy here https://mathematica.stackexchange.com/questions/27842/complex-valued-21d-pde-schr%C3%B6dinger-equation-numerical-method-for-ndsolve. Is that True that NDsolve can solve complex pde? – En-Jui Kuo Jun 15 '22 at 13:48
  • If I replace anything with z, ndsolve can only specify the region of z, like {z,-4,4}. But this also fails. – En-Jui Kuo Jun 15 '22 at 13:57
  • Before trying to solve for F[x,y,0}, try solving NDSolve[{pde, F[z, 0] == Exp[z]}, F[z, t], {z, -4, 4}, {t, 0, 2}]. You need to specify boundary conditions in x and perhaps also add artificial viscosity. By the way, is the equation you ultimately wish to solve also first order? – bbgodfrey Jun 15 '22 at 15:46
  • NO, it is second order and can not be solved using Dsolve, so this is why I want to solve it using NSolve. – En-Jui Kuo Jun 15 '22 at 20:26
  • Please add the code text of NDSolve[…] to the question. If you're having difficulty in formating it, see this post: https://mathematica.meta.stackexchange.com/a/1585/1871 2. "I expected that the condition $F(x,y,0)=F(z,0)=e^z$ would have been enough, as it was for DSolve." That's because in DSolve the i.c. is defined in the whole domain, but that's not the case for NDSolve. Observe the output of e.g. DSolve[{pde, F[z, 0] == Piecewise[{{Exp[z], -1 < Re@z < 1 && -1 < Im@z < 1}}, unknown]}, F, {z, t}] and think about why. 3. Can you add some background info of the problem?
  • – xzczd Jun 16 '22 at 03:53