Are there any packages or readily available methods for solving linear integro differential equations of the form
$\dot{f}(t)=-\int_0^t g(t-s)f(s)\mathrm{d}s$
Thanks already for the answer!
Martin
This particular integro-differential equation can be solved using Laplace transform methods:
eqn = LaplaceTransform[f'[t] == - Integrate[g[t-s] f[s], {s, 0, t}], t, v];
eqn //TeXForm
$v \left(\mathcal{L}_t[f(t)](v)\right)-f(0)=-\left(\mathcal{L}_t[f(t)](v)\right) \left(\mathcal{L}_t[g(t)](v)\right)$
Solving for the Laplace transform of f
:
LT = First @ Solve[eqn, LaplaceTransform[f[t], t, v]];
LT //TeXForm
$\left\{\mathcal{L}_t[f(t)](v)\to \frac{f(0)}{\mathcal{L}_t[g(t)](v)+v}\right\}$
So, the solution to the integro-differential equation is:
soln[g_] = InverseLaplaceTransform[LaplaceTransform[f[t], t, v] /. LT, v, t];
soln[g] //TeXForm
$f(0) \left(\mathcal{L}_v^{-1}\left[\frac{1}{\mathcal{L}_t[g(t)](v)+v}\right](t)\right)$
Obviously, the transforms are not possible without specifying g
. Here is Mariusz` example:
soln[ Function[t, t] ] //TeXForm
$\frac{1}{3} f(0) e^{-t} \left(2 e^{(3 t)/2} \cos \left(\frac{\sqrt{3} t}{2}\right)+1\right)$
which is essentially the same as his answer. A couple other examples:
soln[ Function[t, t^2] ] //TeXForm
$\frac{1}{4} f(0) e^{-\sqrt[4]{-2} t} \left(e^{2 \sqrt[4]{-2} t}+2 e^{\sqrt[4]{-2} t} \cos \left(\sqrt[4]{-2} t\right)+1\right)$
soln[ Function[t, Exp[-t]] ] //TeXForm
$\frac{f(0) e^{-t/2} \left(\sin \left(\frac{\sqrt{3} t}{2}\right)+\sqrt{3} \cos \left(\frac{\sqrt{3} t}{2}\right)\right)}{\sqrt{3}}$
And, an example where Mathematica is unable to compute the inverse Laplace transform:
soln[ Function[t, Exp[-t^2] ]] //TeXForm
$f(0) \left(\mathcal{L}_v^{-1}\left[\frac{1}{\frac{1}{2} \sqrt{\pi } e^{\left.v^2\right/4} \operatorname{erfc}\left(\frac{v}{2}\right)+v}\right](t)\right)$
In this case it is necessary to compute the inverse Laplace transform numerically.
I don't know for any packages to ready for solving linear integro differential equations. Coding obtained in a straightforward fashion borrowed from here.
n = 6;
g[t_] := t;
frule = f -> Function[t, Sum[a[j]*t^j, {j, 0, n}] + O[t, 0]^(n + 1)];
eq = f'[t] == -Integrate[f[s]*g[t - s], {s, 0, t}] /. frule // Simplify;
le = LogicalExpand[eq];
sol = Solve[{le, (f[t] /. frule /. t -> 0) == 1}, Table[a[i], {i, 0, n}]];
(*With the initial conditions f[0]=1.Code works only with initial conditions !!! *)
Fsol[t_] = f[t] /. frule /. First@sol // Normal
(* 1 - t^3/6 + t^6/720 *)
sol2 = DSolve[{f[0] == 1, f'[t] == -Integrate[f[s]*g[t - s], {s, 0, t}]}, f[t], t]
(* {{f[t] -> 1/3 (E^-t + 2 E^(t/2) Cos[(Sqrt[3] t)/2])}} *)
Plot[{Evaluate@Fsol[t], Evaluate[(f[t] /. sol2[[1]])]}, {t, 0, Pi},
PlotLegends -> {"Series", "Symbolic"}]