-
-
Save ikirill/931dbf6fb3581f7d66353b74c4743cd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClearAll[hi1, h1, g1] | |
hi1 = Compile[{{x, _Real}, {En, _Real}, {pz, _Real}, {k4, _Real}, \ | |
{kp, _Real}}, | |
((Sqrt[0.316/(1. + | |
1.2*((k4 + 0.5*En)^2 + kp + (x*pz)^2))^1.*0.316/(1. + | |
1.2*((k4 - 0.5*En)^2 + kp + ((1. - x)*pz)^2))^1.])*((1. - | |
x)*0.316/(1. + 1.2*((k4 + 0.5*En)^2 + kp + (x*pz)^2))^1. + | |
x*0.316/(1. + | |
1.2*((k4 - 0.5*En)^2 + | |
kp + ((1. - x)*pz)^2))^1.))/(((k4 + 0.5*En)^2 + | |
kp + (x*pz)^2 + (0.316/(1. + | |
1.2*((k4 + 0.5*En)^2 + kp + (x*pz)^2))^1.)^2)*((k4 - | |
0.5*En)^2 + | |
kp + ((1. - x)* | |
pz)^2 + (0.316/(1. + | |
1.2*((k4 - 0.5*En)^2 + kp + ((1. - x)*pz)^2))^1.)^2)) | |
] | |
h1[x_?NumericQ, En_?NumericQ, pz_?NumericQ] := | |
1./(En^2 + pz^2 + 0.24^2)*NIntegrate[ | |
hi1[x, En, pz, k4, kp], {k4, -\[Infinity], \[Infinity]}, {kp, | |
0, \[Infinity]}, | |
Method -> "LocalAdaptive", | |
MaxRecursion -> | |
100];(*LocalAdaptive seems to work slightly faster*) | |
g1[x_] := h1[0.5, x, 2.]; | |
Timing@Total[Table[g1[x], {x, N@Range[-2, 2, 1/8]}]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment