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]==0, x'[0] == 0}, {x[t]}, {t}]
But it gives error messages. Is there a way in Mathematica to solve this integral/DE equation?
Answer
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[5]) t -
1/2 (-3 + Sqrt[5]) τ) (-(-2 + Sqrt[5]) E^(Sqrt[5] t) - (2 + Sqrt[5]) E^(
Sqrt[5] τ)))/Sqrt[5] + 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[5]) t -
1/2 (-3 + Sqrt[5]) τ) (-(-2 + Sqrt[5]) E^(Sqrt[5] t) - (2 + Sqrt[5]) E^(
Sqrt[5] τ)) x[τ])/Sqrt[5], {τ, 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}]
Comments
Post a Comment