0
$\begingroup$

I try to compute the analytic form of the convolution of $\operatorname{sech}$ squares function. Mathematica takes so much time to try and find the answer. Here is my code:

Simplify[Convolve[A*Sech[1.7627*x/\[Sigma]]^2, A*Sech[1.7627*x/\[Sigma]]^2, x, y]]
$\endgroup$
2
$\begingroup$
Convolve[A Sech[α x/σ]^2, A Sech[α x/σ]^2, x, y, Assumptions -> {α, σ} \[Element] Reals]

(4 A^2 (-σ + y α Coth[(y α)/σ]) Csch[(y α)/σ]^2)/α

This took 500s to run on my system.

$\endgroup$
  • 2
    $\begingroup$ Since only the ratio \[Alpha]/\[Sigma] appears, you can significantly speed up the calculation by replacing the ratio with a single variable and then returning the ratio. $\endgroup$ – Bob Hanlon Apr 4 '17 at 16:37
  • 1
    $\begingroup$ Indeed, and I did that initially and you are right that it speeds it up significantly. I also wanted to show the outcome explicitly but perhaps demonstrating the more intelligent approach would have been... more intelligent! $\endgroup$ – Quantum_Oli Apr 4 '17 at 16:47
  • $\begingroup$ To do both: Module[{a, expr}, expr = A Sech[α x/σ]^2 /. α -> a*σ; Assuming[{a \[Element] Reals}, Simplify[ Convolve[expr, expr, x, y] /. a -> α/σ]]] // AbsoluteTiming $\endgroup$ – Bob Hanlon Apr 4 '17 at 17:00
  • $\begingroup$ Ahh. i didn't know mathematica would also try for complex number, no wonder it is so difficult for it to run. $\endgroup$ – el psy Congroo Apr 10 '17 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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