0
$\begingroup$

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}]]
$\endgroup$
5
  • 1
    $\begingroup$ What does it mean that you want to integrate the variable x from 0 to x? $\endgroup$
    – bill s
    Commented Nov 30, 2019 at 0:53
  • 1
    $\begingroup$ Your question makes no sense. If $\tau >0$ and the integral goes from $x=0$, then there will always be a value where $x=\tau$. $\endgroup$ Commented Nov 30, 2019 at 1:37
  • $\begingroup$ I assume you mean, Assuming[{Element[{x, τ}, Reals], x > 0, τ > 0, (x - τ) != 0}, Integrate[Exp[Csch[(x - τ)]^2], {τ, 0, x}]]. The integral is infinite. $\endgroup$
    – bbgodfrey
    Commented Nov 30, 2019 at 3:58
  • $\begingroup$ ParametricNDSolve[] is usable for this. $\endgroup$ Commented Nov 30, 2019 at 6:15
  • $\begingroup$ @J.M.willbebacksoon. I think my answer implements something similar to what ParametricNDSolve would do. $\endgroup$
    – m_goldberg
    Commented Nov 30, 2019 at 6:27

2 Answers 2

3
$\begingroup$

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"]]

plot

$\endgroup$
3
  • $\begingroup$ Thank you @m_goldberg. Can you also look at (mathematica.stackexchange.com/questions/210534/…) and give me an input? Appreciate it. $\endgroup$
    – Kobe
    Commented Nov 30, 2019 at 23:12
  • $\begingroup$ @Sankalpa. That is a much more difficult integral to deal with. The techniques I used here might help, but using them would require a lot of non-trivial effort. I don't have the spare time to make such an effort. $\endgroup$
    – m_goldberg
    Commented Nov 30, 2019 at 23:36
  • $\begingroup$ I totally understand. Thank you for sharing this solution with me. Appreciate it. $\endgroup$
    – Kobe
    Commented Dec 1, 2019 at 4:21
1
$\begingroup$

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}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you @Carl Woll $\endgroup$
    – Kobe
    Commented Nov 30, 2019 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.