Skip to content

Instantly share code, notes, and snippets.

@ikirill ikirill/Q.nb Secret
Created Jul 9, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.