Here is a function $F(r)$ which contains double integrations
$$F(r)=\exp\left[ \int_{0}^r dw \,\exp\left(-\int_{0}^w ds \frac{s^2}{s^2+1} \left(1-\exp(- s)\right) \right) \right]$$
I am fine for either/both obtaining
(1) a analytic solutions $F(r)$ (say, in terms of just a function of $r$),
or
(2) a numerical function of $r$ (say, a x-y plot of x=$r$ v.s. y=$f(r)$, even just a selection of points running from $\{r, 0, 100, 1\}$)
I find the most challenge part is that the choices we can make for doing the Integrate and NIntegrate. How to wisely choose NIntegrate and Integrate to obtain the answer.
For example, what will be the plot of Plot[F(r),{r,0,100}]
or ListPlot[F(r),{r,0,100,1}]
looks like?
Answer
The inner integral can be performed symbolically by
si = Integrate[s^2 (1 - Exp[-s])/(s^2 + 1), {s, 0, w}, Assumptions -> w > 0]
(* w - ArcTan[w] + 1/2 (-2 + 2 E^-w - I E^I ExpIntegralEi[-I] +
I E^-I ExpIntegralEi[I] + I E^I ExpIntegralEi[-I - w] - I E^-I ExpIntegralEi[I - w]) *)
and the outer integral numerically by
s = NDSolveValue[{f'[w] == Exp[-si], f[0] == 0}, f, {w, 0, 10}];
F[r_] := Exp[s[r]]
Plot[F[r], {r, 0, 10}, PlotRange -> All, AxesLabel -> {r, "F"},
ImageSize -> Large, LabelStyle -> Directive[Bold, Black, Medium]]
Addendum
Although certainly not necessary, it is possible to simplify si
as follows.
FullSimplify[ComplexExpand[si, TargetFunctions -> {Re, Im}], w > 0];
% /. 1/2 I E^-I (E^(2 I) ExpIntegralEi[-I - w] - ExpIntegralEi[I - w])
-> Im[Exp[-I] ExpIntegralEi[I - w]]
% /. CosIntegral[1] Sin[1] - 1/2 Cos[1] (Pi + 2 SinIntegral[1]) - 1
-> N[CosIntegral[1] Sin[1] - 1/2 Cos[1] (Pi + 2 SinIntegral[1]) - 1]
(* -2.07596 + E^-w + w - ArcTan[w] + Im[E^-I ExpIntegralEi[I - w]] *)
Comments
Post a Comment