# How to solve this integro-differential equation in Mathematica?

I am a new user of Mathematica, and I am trying to figure out how to solve the following integro-differential equation in Mathematica:

$$\frac{\partial c(x,t)}{\partial t} = -2 \mu x c(x,t) + 4 \mu \int_{x}^{\infty} c(s,t) \mathrm{d} s$$,

where $$\mu$$ is a constant.

By setting the initial condition as $$c(x,0)=\delta(N-x)$$, where $$\delta(x)=1$$ if $$x=N$$, and $$\delta(x)=0$$ otherwise (Kronecker delta function), the expected solution is given by:

$$c(x,t) = [4 \mu t + 4 \mu^2 t^2 (N-x)] e^{-2 \mu x t}$$

when $$0. If $$x=N$$, $$c(x,t) = e^{-2 \mu N t}$$. For $$x \leq 0$$ or $$x > N$$, $$c(x,t)=0$$.

I tried the following in Mathematica:

pdeeq = D[c[x,t], t] == -2*m*x*c[x,t] + 4*m*Integrate[c[s,t], {s, x, N}]
soleq = DSolveValue[{pdeeq,c[x, 0] == KroneckerDelta[x, N]}, c[x,t], {x,t}]


However, instead of the expected solution indicated above, I get:

Am I missing something? Why the output from Mathematica does not match the expected output?

• Differentiating your equation gives a pde: D[-D[c[x, t], t] - 2*m*x*c[x, t] + 4*m*Integrate[c[s, t], {s, x, N}], x] $-2 m x c^{(1,0)}(x,t)-c^{(1,1)}(x,t)-6 m c(x,t)=0$ Commented Nov 2, 2023 at 15:56
• Are you sure that the initial condition shouldn't be a Dirac delta function instead of a Kronecker delta? Commented Nov 2, 2023 at 16:45
• It's best practice not to use N as a variable in Mathematica, since N is the function that converts symbolic values into numerical ones (e.g. N[Pi] = 3.1415926...) Commented Nov 2, 2023 at 18:45

Your equation is separable and can be solved analitically. If you define

$$c(x,t)=c_1(x)c_2(t)$$

and substitute back into your equation, you see you obtain the two equations:

$$c_2^\prime(t)=L\,c_2(t)$$

$$L\,c_1(x)=-2m x c_1(x)+4m\, \int_x^N c_1(s) ds$$

The first is trivial, the second can be solved with a further derivation in $$x$$, and also becomes trivial.

The separation constant is obtained from your boundary conditions.

• For the second, you could also define $\int_x^N c_1 ds = C(x)$ and $c_1(x)=-C^\prime(x)$, solve for $C$ and finally take the derivative of the result. Commented Nov 2, 2023 at 16:21

Mathematica can't solve your integral equation, DSolve only returns a simplified form I think:

pdeeq = D[c[x,t], t] == -2*m*x*c[x,t] + 4*m*Integrate[c[s,t], {s, x, N}]
soleq = DSolve [{pdeeq,c[x, 0] == KroneckerDelta[x, N]}, c[x,t], {x,t}]


$$c(x,t)=e^{-2 m t x} \left(-\int _1^t-4 e^{2 m x K[1]} m \int_x^N c(s,K[1]) \, dsdK[1]+\int _1^0-4 e^{2 m x K[1]} m \int_x^N \delta _{N,s} \, dsdK[1]+\delta _{N,x}\right)$$