Message Boards Message Boards

0
|
2680 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Compute definite integrals with tanh? no output

Posted 2 years ago

I am trying to compute the following definite integral,

Integrate[Sqrt[g*m]Divide[Tanh[Divide[Sqrt[g*k],Sqrt[m]]x],Sqrt[k]],{x,0,x}]

(Paste this into Wolfram to see it)

If you are too lazy, it is basically the definite integral from 0 to x of some constants multiplied by tanh(constants*x) dx

For some reason, even though I have Wolfram Pro, it attempts to compute this integral for less than 10 seconds, then just stops, with no answer, no error message, nothing.

What is going on? Is the integral simply too hard for Wolfram to compute? Please help.

POSTED BY: Ron Ellenbogen
4 Replies
Posted 2 years ago

On Mathematica "13.2.0 for Mac OS X ARM (64-bit) (November 18, 2022)", after ~25s I get

(Sqrt[m] Sqrt[g m] Log[Cosh[(Sqrt[g k] x)/Sqrt[m]]])/(Sqrt[k] Sqrt[g k])
POSTED BY: Rohit Namjoshi
Posted 2 years ago

Thank you so much

POSTED BY: Ron Ellenbogen

For me it seem to be way faster if it is done like so:

anitDeriv = Integrate[Sqrt[g*m] Divide[Tanh[Divide[Sqrt[g*k], Sqrt[m]] x], Sqrt[k]], x];
integ = anitDeriv (*at x anyway*) - (anitDeriv /. x -> 0)

It would be interesting to know what the reason for this effect might be.

POSTED BY: Henrik Schachner

I guess that with a definite integral Mathematica tries to work out possible branch cuts. Adding assumptions makes the computation faster on my system, starting from a fresh kernel:

Integrate[
 Sqrt[g*m] Divide[Tanh[Divide[Sqrt[g*k], Sqrt[m]] x], Sqrt[k]],
 {x, 0, t},
 Assumptions -> And[g > 0, k > 0, m > 0, Element[t, Reals]]]

Computing a primitive is exempt from such checks.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract