Differential Equations of Complex Variables

Several years ago there was a question on the Igor Mail List about solving in Igor ODEs having complex variables. John Weeks replied that you have to decompose the system into 2N real variables. I have just had the need to do this, and found that a systematic approach does not require full decomposition by the user, and Igor complex number functions can reduce the burden of doing so. Here is a brief code example showing how to maintain much of the complex nature of the internal variables in the ODE derivative routine, with only minimal additional burden. The example happens to be for phase-matched optical parametric amplification including pump depletion (not generally treated in texts). All units and variables are normalized.
Function OPA(pw, zz, yw, dydz)
Wave    pw      // pw[0] = imK1, pw[1] =imK2, pw[2] = imK3
Variable  zz      // z value at which to calculate derivatives
Wave    yw      // yw[0]-yw[5] containing real and imag parts of 3 complex variables
Wave    dydz   // wave to receive d reE1/dz, d ImE1/dz etc. (output)

//             idler                      signal                              pump
variable/C E1 = cmplx(yw[0],yw[1]) , E2 = cmplx(yw[2],yw[3]), E3 = cmplx(yw[4],yw[5])
variable/C K1 = cmplx(0,pw[0]),      K2 = cmplx(0,pw[1]),     K3 = cmplx(0,pw[2])

dydz[0] =  real( K1 * conj(E2) * E3 )     //   idler
dydz[1] =  imag( K1 * conj(E2) * E3 )

dydz[2] =  real( K2 * conj(E1) * E3 )     //   signal
dydz[3] =  imag( K2 * conj(E1) * E3 )

dydz[4] =  real( K3 * E1 * E2 )           //   pump
dydz[5] =  imag( K3 * E1 * E2 )
return 0
End
//---------------------------------------------------------------------------------------------------------------------------------------
Function testOPA()

Make/D/O/N=(400,6) wopa
setscale/P x, 0, 0.005, wopa
wopa[0][0]  =  0.0     //   real idler     //  initial conditions at z=0
wopa[0][1]  =     0.0   //  imag idler
wopa[0][2]  =     0.2   //  real signal
wopa[0][3]  =     0.0   //  imag signal
wopa[0][4]  =     5     //  real pump
wopa[0][5]  =     0.0   //  imag pump
make/D/O wparm = {(1/3), 1.000, (4/3)}             // ratios of inverse wavelengths
IntegrateODE/M=1/E=1e-6 OPA, wparm, wopa  // derivative function, parameters, results
end

Forum

Support

Gallery