I have been trying to integrate the following and Mathematica couldn't integrate it. Can someone help me on this?
Assuming[{Element[{x, τ}, Reals], x > 0, τ > 0, (x - τ) != 0},
Integrate[Exp[Csch[(x - τ)]^2], {x, 0, x}]]
The integral doesn't seem to have any closed form solution. You can get an approximation to it by building an interpolating function and integrating it. Like so:
Clear[f, pts, ff, int]
f[τ_][u_] := Exp[Csch[(u - τ)]^2];
ff[τ_, x_, dx_] := Interpolation[Table[{u, f[τ][u]}, {u, 0, x, dx}]];
int[x_, dx_][τ_] := Function[u, Integrate[ff[τ, x, dx][uu], {uu, 0, u}]]
Then, given τ = 2, x = 1.25, dx = .001
, we can use int[x, dx][τ]
as function that behaves like the function that is the integral of f
. For example:
With[{τ = 2, x = 1.25, dx = .001},
Plot[{f[τ][u], int[x, dx][τ][u]}, {u, 0, x}, PlotLegends -> "Expressions"]]
As suggested by @JM, you can use ParametricNDSolveValue
to obtain a numerical approximation to your integral:
pf = ParametricNDSolveValue[
{
int'[u] == Exp[Csch[u-τ]^2],
int[0] == 0
},
int,
{u, 0, τ-.1}, (* avoid singularity at τ *)
τ
];
Visualization (using @m_goldbergs settings):
Plot[{Exp[Csch[x-2]^2], pf[2][x]}, {x, 0, 1.25}]
Assuming[{Element[{x, τ}, Reals], x > 0, τ > 0, (x - τ) != 0}, Integrate[Exp[Csch[(x - τ)]^2], {τ, 0, x}]]
. The integral is infinite. $\endgroup$ParametricNDSolve[]
is usable for this. $\endgroup$ParametricNDSolve
would do. $\endgroup$