TransWikia.com

Solving complex differential equation with ParametricNDSolveValue

Mathematica Asked on February 1, 2021

I am trying to solve a complex differential equation for the function $S(u,v)$ depending on the parameter $omega$. The code is:

ClearAll["Global`*"]
m = 100;
L = 2;
r[u_, v_] = 2 m (1 + ProductLog[- ((u v)/E)]);
F[u_, v_] = (32 m^3)/r[u, v]^3 Exp[-(r[u, v]/(2 m))];
Vz[u_, v_] = FullSimplify [-2 (D[F[u, v], u] D[F[u, v], v])/F[u, v] + 
    4 D[r[u, v], u, v]/r[u, v] + 2/F[u, v] D[F[u, v], u, v] + 
    2/F[u, v] D[F[u, v], u] D[r[u, v], v] + 
    2/F[u, v] D[F[u, v], v] D[r[u, v], u]];
Z[u_, v_] = Exp[-I (u + v)/2 ω] S[u, v];
sol = ParametricNDSolveValue[{D[Z[u, v], u, v] + 
     F[u, v] (L (L + 1))/r[u, v]^2 Z[u, v] + Z[u, v] Vz[u, v] == 0, 
   S[u, -1] == 1, S[1, v] == 1}, 
  S, {u, 1, 100}, {v, -100, -1}, ω]

I get the error

ParametricNDSolveValue::mconly: "For the method !("IDA"), only
machine real code is available. Unable to continue with complex values
or beyond floating-point exceptions"

So it seems that Mathematica expects real numbers, but it finds complex numbers instead. How can I solve the differential equation?

One Answer

This question can be addressed by solving for Z rather than S, splitting the PDE into its real and imaginary parts, and later constructing S if desired.

solr[ω_] := NDSolveValue[{D[Z[u, v], u, v] + 
    F[u, v] (L (L + 1))/r[u, v]^2 Z[u, v] + Z[u, v] Vz[u, v] == 0, 
    Z[u, -1] == Cos[1/2 (-1 + u) ω], Z[1, v] == Cos[1/2 (1 + v) ω]}, 
    Z, {u, 1, 2}, {v, -2, -1}]
soli[ω_] := NDSolveValue[{D[Z[u, v], u, v] + 
    F[u, v] (L (L + 1))/r[u, v]^2 Z[u, v] + Z[u, v] Vz[u, v] == 0, 
    Z[u, -1] == -Sin[1/2 (-1 + u) ω], Z[1, v] == -Sin[1/2 (1 + v) ω]}, 
    Z, {u, 1, 2}, {v, -2, -1}]

zr = solr[1];
Plot3D[zr[u, v], {u, 1, 2}, {v, -2, -1}, PlotRange -> All, 
    ImageSize -> Large, AxesLabel -> {u, v, z}, LabelStyle -> {15, Black, Bold}]

enter image description here

zi = soli[1];
Plot3D[zi[u, v], {u, 1, 2}, {v, -2, -1}, PlotRange -> All, 
    ImageSize -> Large, AxesLabel -> {u, v, z}, LabelStyle -> {15, Black, Bold}]

enter image description here

Two notes. First, the integration ranges of u and v have been greatly reduced, because the solution grows exponentially large otherwise, and Plot3D fails. Second, using ParametricNDSolveValue instead of SetDelayed and NDSolveValue causes the kernel to crash.

Answered by bbgodfrey on February 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP