Sometimes it is useful to split a complex equation into its real and imaginary parts. Consider the following ode
ode = y'''[x] - k^3*y[x] == I*k*a*((2*x - c)*(y''[x] - k^2*y[x]) + 2*y[x])
bc1 = y'[0] == 0;
bc2 = y''[1] + k^2*y[1]/(1 - c) == 0;
in which y[x] is a complex function with a real independent variable x, $a$ is a real parameter, and $k$ and $c$ are complex parameters. If we write y[x]=yr[x]+I yi[x], k=kr+ I ki, and c=cr+I ci, how can I transfer the system in terms of two real equations odereal and odeimag togeter with their boundary conditions bc1real, bc1imag, bc2real, bc2imag.
For example,
y[x_] := yr[x] + I*yi[x]
bc1 /. y -> y[x]
(*I Derivative[1][yi][0] + Derivative[1][yr][0] == 0*)
Problem: We can see that the real and imaginary parts still are written together in the boundary condition. Note also that I did not need to solve the equation at present. What I want is, for example,
bc1real = Derivative[1][yr][0] == 0
bc1imag = Derivative[1][yi][0] == 0
with a similar split-form for the ode and bc2.
Thank you for any suggestions.
realPart[eq_, real_, imag_] := Simplify[Map[Re, eq], Assumptions -> Element[real, Reals] && Element[imag,Complexes]]; imagPart[eq_, real_, imag_] := Simplify[Map[Im, eq], Assumptions -> Element[real, Reals] && Element[imag, Complexes]];testing withode = Expand[I*(y''[x] + k^2) + a == 0],realode = realPart[ode, x | a, y | k]givesa == Im[k^2] + Im[(y^\[Prime]\[Prime])[x]]. Well, it is expected to yielda == 2 Re[k] Im[k] + Im[(y^\[Prime]\[Prime])[x]]. – Nobody Jul 07 '20 at 04:01