# Integration by Numerical Methods

I have a big expression,

    (E^(-((Ep^2 + Eq^2 + p^2 + q^2)/(
2 σ^2))) (E^(-I (θp + θq))
p q Sin[ϕp] Sin[ϕq] Sinh[ζ/
2]^2 + ((Ep + m) Cosh[ζ/2] +
p Cos[ϕp] Sinh[ζ/2]) ((Eq + m) Cosh[ζ/2] +
q Cos[ϕq] Sinh[ζ/2])) (1/
2 (Ep + m) (Eq + m) (1 + Cosh[ζ]) +
p q (Cos[ϕp] Cos[ϕq] +
E^(I (θp + θq))
Sin[ϕp] Sin[ϕq]) Sinh[ζ/2]^2 +
1/2 ((Eq + m) p Cos[ϕp] + (Ep +
m) q Cos[ϕq]) Sinh[ζ]))/(2 (Ep + m) (Eq +
m) n n1 (m + Ep Cosh[ζ] +
p Cos[ϕp] Sinh[ζ]) (m + Eq Cosh[ζ] +
q Cos[ϕq] Sinh[ζ]))



I tried analytically integrating it over p,q,$$\theta p$$,$$\theta q$$,$$\phi p$$,$$\phi p$$ with the limits $$(-\infty,\infty)$$,$$(-\infty,\infty)$$,$$(0,\pi)$$,$$(0,\pi)$$,$$(0,2\pi)$$,$$(0,2\pi)$$, it does not work, i.e., I ran it for 24 hours before aborting. I have 16 such expressions so that is not feasible for me

NIntegrate tells me to give all values numerically. But I want an expression with just the above expression integrated out. Is there any way to do that?

• What is known about the parameters  Ep, Eq, m, n, n1, p, q, [Zeta] ? Commented Nov 17, 2023 at 9:02
• The limits for p,q is given as (−∞,∞) ,(−∞,∞). The others I do not want to integrate over I want the result to be their function Commented Nov 17, 2023 at 9:05
• I asked for the parameters , not the integration limits! Commented Nov 17, 2023 at 9:13
• Ep,Eq are energies. m is mass, n,n1 are normalization constants, p,q are three momenta and zeta is rapidity Commented Nov 17, 2023 at 11:12
• I fail to see how you can numerically integrate something and get a symbolic expression. Numerical integration must always return a number, surely? If we ignore the complicated expression for a moment, can you give a very simple example of integrating something numerically that gives a symbolic result ? I don't think Mathematica can do what you're asking for. Commented Nov 17, 2023 at 11:55

Expand your expression into a sum of simple fractions and integrate step by step over the different variables

$$\text{df}=\frac{e^{-\frac{\text{Ep}^2+\text{Eq}^2+p^2+q^2}{2 \sigma ^2}} \left(\left((\text{Ep}+m) \cosh \left(\frac{\zeta }{2}\right)+p \sinh \left(\frac{\zeta }{2}\right) \cos (\text{\phi p})\right) \left((\text{Eq}+m) \cosh \left(\frac{\zeta }{2}\right)+q \sinh \left(\frac{\zeta }{2}\right) \cos (\text{\phi q})\right)+p q \sinh ^2\left(\frac{\zeta }{2}\right) e^{-i (\text{\theta p}+\text{\theta q})} \sin (\text{\phi p}) \sin (\text{\phi q})\right) \left(\frac{1}{2} (\text{Ep}+m) (\text{Eq}+m) (\cosh (\zeta )+1)+\frac{1}{2} \sinh (\zeta ) (q (\text{Ep}+m) \cos (\text{\phi q})+p (\text{Eq}+m) \cos (\text{\phi p}))+p q \sinh ^2\left(\frac{\zeta }{2}\right) \left(\cos (\text{\phi p}) \cos (\text{\phi q})+e^{i (\text{\theta p}+\text{\theta q})} \sin (\text{\phi p}) \sin (\text{\phi q})\right)\right)}{2 n \text{n1} (\text{Ep}+m) (\text{Eq}+m) (\text{Ep} \cosh (\zeta )+m+p \sinh (\zeta ) \cos (\text{\phi p})) (\text{Eq} \cosh (\zeta )+m+q \sinh (\zeta ) \cos (\text{\phi q}))}$$

    (  dfn = List @@ (df // Apart // Expand))[[1]] // TeXForm



$$\frac{\text{Ep} \ \text{Eq} \ \cosh ^2 \ \left(\frac{\zeta }{2}\right) \ \exp \left(-\frac{\text{Ep}^2}{2 \sigma ^2}-\frac{\text{Eq}^2}{2 \sigma ^2}-\frac{p^2}{2 \sigma ^2}-\frac{q^2}{2 \sigma ^2}\right)}{4\ n \ \text{n1}\ (\text{Ep} \ \cosh (\zeta )\ +\ m \ +\ p \ \sinh (\zeta ) \ \cos (\text{\phi p}))\ (\text{Eq} \ \cosh (\zeta )\ + \ m \ + \ q \ \sinh (\zeta ) \ \cos (\text{\phi q}))}$$

Drop any factor not dependent on the integration variable and integrate stepwise

     dfn[[1]] /. {x__?(FreeQ[\[Phi]q])*y_ :> y}


$$\frac{1}{\text{Eq} \ \cosh (\zeta )\ + \ m \ + \ q \ \sinh (\zeta ) \ \cos (\text{\phi q})}$$

    Assuming[Sinh[\[Zeta]] > 0 && E^\[Zeta] > 1 && Cosh[\[Zeta]] > 1 &&m >0 &&  Eq > 0 ,
Integrate[1/( m + Eq Cosh[\[Zeta]] + q Cos[\[Phi]q] Sinh[\[Zeta]]),\[Phi]q, 0, 2 \[Pi]}]]



$$\begin{array}{cc} \{ & \begin{array}{cc} -\frac{4 \pi e^{\zeta }}{\sqrt{2 \text{Eq}^2 e^{2 \zeta }+\text{Eq}^2 e^{4 \zeta }+\text{Eq}^2+4 \text{Eq} e^{\zeta } m+4 \text{Eq} e^{3 \zeta } m+4 e^{2 \zeta } m^2+2 e^{2 \zeta } q^2-e^{4 \zeta } q^2-q^2}} & \left| \frac{-2 e^{2 \zeta } \text{Eq}-2 \text{Eq}-4 e^{\zeta } m+\sqrt{\left(2 e^{2 \zeta } \text{Eq}+2 \text{Eq}+4 e^{\zeta } m\right)^2-4 \left(e^{2 \zeta } q-q\right)^2}}{e^{2 \zeta } q-q}\right| \geq 2\land \left| \frac{-2 e^{2 \zeta } \text{Eq}-2 \text{Eq}-4 e^{\zeta } m-\sqrt{\left(2 e^{2 \zeta } \text{Eq}+2 \text{Eq}+4 e^{\zeta } m\right)^2-4 \left(e^{2 \zeta } q-q\right)^2}}{e^{2 \zeta } q-q}\right| <2 \\ \frac{4 \pi e^{\zeta }}{\sqrt{2 \text{Eq}^2 e^{2 \zeta }+\text{Eq}^2 e^{4 \zeta }+\text{Eq}^2+4 \text{Eq} e^{\zeta } m+4 \text{Eq} e^{3 \zeta } m+4 e^{2 \zeta } m^2+2 e^{2 \zeta } q^2-e^{4 \zeta } q^2-q^2}} & \left| \frac{-2 e^{2 \zeta } \text{Eq}-2 \text{Eq}-4 e^{\zeta } m+\sqrt{\left(2 e^{2 \zeta } \text{Eq}+2 \text{Eq}+4 e^{\zeta } m\right)^2-4 \left(e^{2 \zeta } q-q\right)^2}}{e^{2 \zeta } q-q}\right| <2\land \left| \frac{-2 e^{2 \zeta } \text{Eq}-2 \text{Eq}-4 e^{\zeta } m-\sqrt{\left(2 e^{2 \zeta } \text{Eq}+2 \text{Eq}+4 e^{\zeta } m\right)^2-4 \left(e^{2 \zeta } q-q\right)^2}}{e^{2 \zeta } q-q}\right| \geq 2 \\ \end{array} \\ \end{array}$$

Since all members in the list have product form in the variables, its possible to integrate the union of all factors as 1-d integrals over their respective intervals. This is making sense only if the conditions can be evaluated beforehand by fixing the numerical factors in their respective physical ranges.

Store the intgral list of the integral factors obtained as a list of rules int the form

  expr_ dfk :> expr intdfk


and apply it to the list dfn

  Plus@@  ( dfn//.rules)


If there are integrals unevaluated, do the by Nintegrate with numerical coefficients.

This strategy breaks down, if the conditions stemming from residuum evaluations, are more complex than the n-fold integral.

• If I am not mistaken, the result of FindInstance[(2 (Ep + m) (Eq + m) n n1 (m + Ep Cosh[\[Zeta]] + p Cos[\[Phi]p] Sinh[\[Zeta]]) (m + Eq Cosh[\[Zeta]] + q Cos[\[Phi]q] Sinh[\[Zeta]])) == 0, {Ep, m, Eq, n1, \[Zeta], \[Phi]p, \[Phi]q, q, n, p}, Reals, 2] which is {{Ep -> 174, m -> -231, Eq -> -(6/5), n1 -> 5/2, \[Zeta] -> Log[1/174 (231 + 9 Sqrt[285])], \[Phi]p -> -((103 \[Pi])/ 2), \[Phi]q -> -(19/10), q -> -1, n -> -(14/5), p -> 1/2}, {...}} demonstrates the possibility of the divergence of this integral. Commented Nov 17, 2023 at 17:26