Clear["Global`*"];
Psi1[r_, z_] := Exp[-2*z^2]*(Exp[-1.3*r^2] + Exp[-4*r^2] + Exp[-2.3*r^2]);
NN = 1/Sqrt[
Integrate[
Psi1[r, z]*Psi1[r, z]*r*2*Pi, {r, 0, Infinity}, {z, -Infinity,
Infinity}]];
Psi[r_, z_] := NN*Psi1[r, z];
Putting FullSimplify
on the RHS of SetDelayed
results in the simplification being used for every call to Kk
. Use Set
to do the simplification only once
Kk[r_, z_] =
FullSimplify[
Psi[r, z]*Laplacian[Psi[r, z], {r, θ, z}, "Cylindrical"]*r*2*Pi];
Note that the timing should be isolated from the definition of Kx
(Kx = -(1/2)*
Integrate[
Kk[r, z], {r, 0, Infinity}, {z, -Infinity, Infinity}]) // AbsoluteTiming
(* {3.86644, 3.06865} *)
Since you introduced a machine precision number in the definition of Psi1
, your calculations are done with machine precision. Since you are not concerned about precision, you can speed it up more by just using NIntegrate
(Kx = -(1/2)*
NIntegrate[
Kk[r, z], {r, 0, Infinity}, {z, -Infinity, Infinity}]) // AbsoluteTiming
(* {0.011498, 3.06865} *)