# Using DSolve to solve an integral equation

I've the following integral (or DE) that I need to solve (for $$x(t)$$ and all the constants are known, real and positive):

$$k\cdot\theta\left(t-m\right)+(n-k)\cdot\theta\left(t-v\right)=$$ $$x(t)\cdot\text{a}+\text{b}\cdot\ln\left(1+\frac{x(t)}{\text{c}}\right)+\int_0^tx(\tau)\cdot\mathcal{L}_\text{s}^{-1}\left\{\frac{1}{\frac{1}{f+sl}+\frac{s}{qs+p}}\right\}_{\left(t-\tau\right)}\space\text{d}\tau\tag1$$

I tried solving the equation with

DSolve[
{x[t]*a + b*Log[1 + ((x[t])/c)] +
Integrate[
x[τ] *
(InverseLaplaceTransform[1/((1/(f + s*l)) + (1/(s/(q*s + p)))), s, t - τ]),
{τ,0,t}] ==
k*HeavisideTheta[t - m] + (n - k)*HeavisideTheta[t - v],
x==0, x' == 0}, {x[t]}, {t}]


But it gives error messages. Is there a way in Mathematica to solve this integral/DE equation?

• Possible duplicate of Integral equation numerical solution with NDSolve – egwene sedai Jan 18 at 22:04
• @egwenesedai This question is not a duplicate of that one, I'm afraid. It's hard (if not impossible) to use the technique mentioned in that post to solve this problem. – xzczd Jan 20 at 7:16
• With LaplaceTransform the equation can be transformed to b LaplaceTransform[Log[1 + x[t]/c], t, s] + a LaplaceTransform[x[t], t, s] + LaplaceTransform[x[t], t, s]/(1/(f + l s) + (p + q s)/s) == ( k (UnitStep[-m] + E^(-m s) UnitStep[m]))/ s + ((-k + n) (UnitStep[-v] + E^(-s v) UnitStep[v]))/s. But I don't know how to go further, the Log[1 + x[t]/c] is troublesome. Numeric solution may be slightly easier. Is analytic solution necessary for you? If not, please show us a set of numeric values of $a$, $b$, $c$, etc. so we can try if numeric solution is possible. – xzczd Jan 20 at 10:59
• @xzczd Thanks for your comment. Now you can take (for now) all the constants equal to 1, to show a solution. – Jan Jan 20 at 11:02

The following is a possible numeric solution, the key idea is simple: calculate the inverse Laplace transform symbolically first, then discretize the outer integral with right Riemann sum formula. (I know this formula is relatively rough, but given the upper limit is a variable, I'm not aware of better solution. )

We first substitute parameters into the equation and calculate Laplace inversion. Parameters are all set to 1 as suggested by OP in the comment. I've introduced 2 symbols int and inverse instead of Integrate and InverseLaplaceTransform to avoid unnecessary symbolic calculation, and use UnitStep to replace HeavisideTheta because it's more convenient for numeric calculation later.

eq = x[t] a + b Log[1 + x[t]/c] + int[x[τ] inverse[
1/(1/(f + s l) + 1/(s/(q s + p))), s, t - τ], {τ, 0, t}] ==
k HeavisideTheta[t - m] + (n - k) HeavisideTheta[t - v] /.
a | b | c | f | k | l | m | n | p | q | v -> 1 /. HeavisideTheta -> UnitStep /.
inverse -> InverseLaplaceTransform // Simplify

(*
int[((E^(-(1/2) (3 + Sqrt) t -
1/2 (-3 + Sqrt) τ) (-(-2 + Sqrt) E^(Sqrt t) - (2 + Sqrt) E^(
Sqrt τ)))/Sqrt + DiracDelta[t - τ]) x[τ], {τ, 0,
t}] + Log[1 + x[t]] + x[t] == UnitStep[-1 + t]
*)


Since

Assuming[{t >= 0}, Integrate[DiracDelta[t - τ] x[τ], {τ, 0, t}]]
(* x[t] *)


The equation can be further simplified to

eq = eq /. DiracDelta[_] :> 0 /. int[a__] :> int@a + x[t]
(* int[(
E^(-(1/2) (3 + Sqrt) t -
1/2 (-3 + Sqrt) τ) (-(-2 + Sqrt) E^(Sqrt t) - (2 + Sqrt) E^(
Sqrt τ)) x[τ])/Sqrt, {τ, 0, t}] + Log[1 + x[t]] + 2 x[t] ==
UnitStep[-1 + t] *)


Then we define function for calculating right Riemann sum:

int[expr_, {t_, L_, R_, step_}] := step Total@Table[expr, {t, L + step, R, step}]


Finally, discretize the integral equation to a set of nonlinear algebraic equation and solve it with FindRoot:

step = 1/50;
bL = 0; bR = 2;
eqset = Table[eq, {t, bL, bR, step}] /. {τ, bL, a_} :> {τ, bL, a, step};
initial[t_] := 0;
sollst = FindRoot[eqset, Table[{x@t, initial@t}, {t, bL, bR, step}]][[All, -1]];
ListLinePlot[sollst, PlotRange -> All, DataRange -> {bL, bR}] 