I would turn your integral into an ODE. Here is an inactive form of your integral:
a = 20;
d = 1/10;
integral = Inactive[Integrate][
Exp[-w/a] Sin[(w-d)t]/(w-d)^2,
{w, 0, ∞},
GenerateConditions->False
]
Inactive[Integrate][(E^(-w/20) Sin[t (-(1/10) + w)])/(-(1/10) + w)^2, {w, 0, ∞}, GenerateConditions -> False]
Let's take 2 derivatives with respect to t
, and activate:
Activate @ D[integral, {t, 2}]
(20 (-20 t Cos[t/10] + Sin[t/10]))/(1 + 400 t^2)
That's enough information to create the differential equation, now we need to come up with initial conditions:
Activate[integral /. t->0]
Activate[D[integral, t] /. t->0]
0
-((I π + ExpIntegralEi[1/200])/E^(1/200))
We see that the first derivative is complex. However, this is because integral
is divergent, and needs regularization to be evaluated. So, it is actually the real part that is needed. Now, we can solve the ODE:
if = NDSolveValue[
{
f''[t] == Activate @ D[integral, {t, 2}],
f[0] == 0,
f'[0] == Re @ Activate[D[integral, t] /. t->0]
},
f,
{t, 0, 1000}
];
Plotting this solution is fast:
Plot[if[t], {t, 0, 1000}, PlotRange->All]
Let's compare it to plotting your int
function:
p1 = Plot[int[t], {t, 0, 100}, PlotRange->All]; //AbsoluteTiming
p2 = Plot[if[t], {t, 0, 100}, PlotRange->All]; //AbsoluteTiming
p1
p2
{19.7421, Null}
{0.054623, Null}
Finally, as @george2079 says, it is possible to find the integral analytically. One method is to use DSolveValue
:
DSolveValue[
{
f''[t] == Activate@D[integral, {t, 2}],
f[0] == 0,
f'[0] == Re @ Activate[D[integral, t] /. t->0]
},
f,
t
]
Function[{t}, (1/(
200 E^(1/200)))(-200 E^(1/200) t + 200 t Cosh[1/200] +
200 t CosIntegral[I/200] + 5 I CosIntegral[I/200 - t/10] -
100 t CosIntegral[I/200 - t/10] - 5 I CosIntegral[I/200 + t/10] -
100 t CosIntegral[I/200 + t/10] - 200 t ExpIntegralEi[1/200] +
2000 E^(1/200) Sin[t/10] + t Sinc[I/200] + 200 t SinhIntegral[1/200] +
5 SinIntegral[I/200 - t/10] + 100 I t SinIntegral[I/200 - t/10] -
5 SinIntegral[I/200 + t/10] + 100 I t SinIntegral[I/200 + t/10])]
PlotPoints
? $\endgroup$Quit
your kernel and run your code before you post it here for other people to try and run. There are still errors, I think you're still missing brackets. People will be much less likely to help if they have to repeatedly jump through hoops just to look at the problem. $\endgroup$