# NDSolve for f[t,s], with initial condition f[s,s]==1

I try to solve integro-differential equation for a function of two variables, where the initial conditions are given with f[s,s]==1. Mathematica does not like such an initial condition, as I get an error "The arguments should be ordered consistently". How can I solve this?

This is my code:

omega = 1;
g = 1;
alpha[t_, s_] := Exp[-(t - s)];
fsol = NDSolveValue[{D[f[t, s],
t] == (I*omega + g^2*Integrate[alpha[t, s]*f[t, s], {s, 0, t}])*
f[t, s], f[s, s] == 1}, f, {t, 0, 10}, {s, 0, 10}]

• You can't have f[t, s] and also f[s, s] at same time. What does this mean as initial conditions? – Nasser Jul 23 '19 at 7:59
• The meaning is: for all s, f[t=s,s]==1, so when both t and s have the same value function f gives 1. – Agnieszka Jul 23 '19 at 8:06
• I have never seen such an initial conditions in all my life. What is this called? Initial condition, the way I understand it, is: At a particular instance of time say $t_0$, the solution should be some value say $f_0$. But may be someone else knows about this special initial condition and hopefully can better help. – Nasser Jul 23 '19 at 8:18
• Hm, I don't know if there is any special name for it. – Agnieszka Jul 23 '19 at 8:21
• @Nasser What about DirichletCondition[f[t, s] == 1, t == s]? Or rotate the coordinate system by 45 degrees (thinking of t and s formally as spatial coordinates), so that $t=s$ becomes $t'=0$? – Michael E2 Jul 23 '19 at 16:43

## 1 Answer

Expanding the differential equation for small $$t$$, and solving it term by term, reveals a pattern: the solution factorises: $$f(t,s)=F(t)/F(s)$$. Plugging this into the PDE yields an ODE, whose solution is $$f(t,s)=\frac{\left(\sqrt{-4-2 i} e^{\sqrt{-4-2 i} s}+(-3+i)+2 \sqrt{1-2 i}\right) e^\left(\left(\frac{1}{2}+\frac{i}{2}\right) \left(-1+\sqrt{-1+2 i}\right) (s-t)\right)}{\sqrt{-4-2 i} e^{\sqrt{-4-2 i} t}+(-3+i)+2 \sqrt{1-2 i}}$$

Indeed,

{D[f[t, s], t] == (I*omega + g^2*Integrate[alpha[t, q]*f[t, q], {q, 0, t}])*f[t, s], f[s, s] == 1} /. f -> ((E^(((1/2 + I/2) ((1 - I) Sqrt[-2 - I] + Sqrt) (#1 - #2))/Sqrt) ((-3 + I) + 2 Sqrt[1 - 2 I] + Sqrt[-4 - 2 I] E^(Sqrt[-4 - 2 I] #2)))/((-3 + I) + 2 Sqrt[1 - 2 I] + Sqrt[-4 - 2 I] E^(Sqrt[-4 - 2 I] #1)) &) // FullSimplify

(* {True, True} *)