There are many sources that give practical advice on how to program such an integral equation. So I went a different route and asked myself how to get a solution by using the most literal application of the defining equation.
By that I mean no explicit discretization, keeping the integral. That can be done using the assumption that the fixed-point theorem holds for the given equation. That theorem means that if I replace $P(t')$ under the integral by the entire expression for $P(t)$, with $t\to t'$, and keep doing that with all the $P(...)$ that appear, the result will converge.
Be warned that this is best suited for the short-time limit.
For two iterations, that would look like this:
Clear[r]; i = 0; FixedPoint[(i++; (r[K[i + 1]] +
Integrate[# r[K[i] - K[i + 1]], {K[i], 0, K[i + 1]}])) &,
r[K[1]], 2]
$r(K[3])+\int_0^{K[3]} r(K[2]-K[3])
\left(r(K[2])+\int_0^{K[2]} r(K[1]) r(K[1]-K[2]) \,
dK[1]\right) \, dK[2]$
Here, I ran FixedPoint
for only 2
steps because it's a symbolic calculation (I'll make it numerical soon, that's why I went with FixedPoint
). The K[i]
are symbolic integration variables.
Below is a randomly chosen kernel:
r[t_] := t^2
It's not at all realistic, but the integrals are easy to do:
i = 0; FixedPoint[(i++; (r[K[i + 1]] +
Integrate[# r[K[i] - K[i + 1]], {K[i], 0, K[i + 1]}])) &,
r[K[1]], 4]
$\frac{K[5]^{14}}{2724321600}+\frac{K[5]^{11}}{2494800}+
\frac{K[5]^8}{5040}+\frac{K[5]^5}{30}+K[5]^2$
This is the desired approximation for $P(t)=P(K[5])$. Here, K[5]
is the time variable (the outermost integration limit).
Next, I'll make a numerical function out of this, so we can in principle deal with more complicated r[t]
:
Clear[step];
step[t_?NumericQ, function_] :=
r[t] + NIntegrate[function[\[Tau]] r[t - \[Tau]], {\[Tau], 0, t}]
This defines one iteration step for the FixedPoint
search below:
solution[time_] :=
FixedPoint[Function[{t}, step[t, #]] &, r,
SameTest -> (Abs[#1[time] - #2[time]] < 10^(-3) &)][time]
To limit the time of execution, I set a SameTest
that isn't too stringent about when it considers convergence to be achieved.
The result is as follows:
l = Table[solution[t], {t, 0, 2, .1}]
{0., 0.0100003, 0.0400107, 0.090081, 0.160341, 0.251042, 0.362595,
0.495614, 0.650956, 0.829768, 1.03353, 1.26411, 1.5238, 1.81539,
2.14222, 2.50824, 2.91812, 3.37726, 3.89198, 4.46953, 5.11828}
This is only a proof of principle, not intended to be of practical use... I just posted it because it's a concise formulation.