# Coupled Differential equation with integral of its parameters

everyone, I have a set of coupled differential equations as is shown below, and these equations actually describe the interaction of a two-level atom (amplitude is ce(t)) and single-photon (photon with wavevector k and amplitude c(k,t)) in a one-dimensional waveguide. We can easily find the analytical solution by bringing the second formula into the first formula and changing the order of integration, then we can obtain the following equations But I want to directly solve the equations numerically via Mathematica, I know it's difficult to do since we need solve an infinite number of differential equations in principle. I have searched the solution on stack exchange and find the following solutions,

and I write the coupled differential equations in Mathematica as follows

\[Kappa] = 1;
NDSolve[{ce'[t] == -I*(Sqrt[\[Kappa]]*Integrate[ck[k, t], {k, -3, 3}]),
D[ck[k, t], t] == -I*(k*ck[k, t] + Sqrt[\[Kappa]] ce[t]),
ck[k, 0] == 1/(k + 3*I/2), ce == 0}, {ce[t], ck[k, t]}, {t, 0,
10}, {k, -3, 3}]


and the error happens, so how can I write down the coupled differential equations with parameters that have integrals?

First, all the searched for functions must have the same arguments. With this you can not simply write "ce' " but you have to write: D[ce[k,t],t]:

\[Kappa] = 1;
NDSolve[{D[ce[k, t],
t] == -I*(Sqrt[\[Kappa]]*Integrate[ck[k, t], {k, -3, 3}]),
D[ck[k, t], t] == -I*(k*ck[k, t] + Sqrt[\[Kappa]] ce[k, t]),
ck[k, 0] == 1/(k + 3*I/2), ce[k, 0] == 0}, {ce[k, t], ck[k, t]}, {t,
0, 10}, {k, -3, 3}] • Thank you so much for your reply, I think writing the program in your way can let the program runs in Mathematica without errors, however, I think it also changes the original equations? Since ce(k,t) should originally be independent on k, but I will obtain different evolutions of |ce(t)| for different k Apr 3 at 13:03
• You are right, ce may depend on k. However, if the initial/boundary values uniquely determine ce this should be no problem. However, I found a bigger problem. Writing the integral using, as integration variable, the same variable as the PDE uses, does not seem correct. And indeed if I change k to x, MMA is no more able to solve it. I am not sure what MMA actually does when we use the same variable and I do not have a ready answer for this. Apr 3 at 14:29