The following question is an extension of this question Find all roots of a function with parabolic cylinder functions in a range of the variable.
Now I want to use the roots found to calculate a value of an integral for each value of the roots. My question is: is there a way to accelerate the last step? In passing, how do we type greek letters in the Mathematica code section of a question?
σn[M_?NumericQ, λ_?NumericQ, ω_?NumericQ] :=
Module[{c, k, ξ1}, c = Sqrt[M/λ]; k = I M/(2 λ);
ξ1 = (I - 1) (ω/Sqrt[λ] - Sqrt[λ]/2);
({I, (1 + I ) c/2}.ParabolicCylinderD[{k, k - 1},
I ξ1])/({1, (1 + I ) c/2}.ParabolicCylinderD[{-k, -k -
1}, ξ1]) ]
integrand[M_?NumericQ, λ_?NumericQ, ω_?NumericQ, z_?NumericQ]:=
Module[{c,k,ξ},c=Sqrt[M/λ];k=(I M)/(2λ);ξ = (I - 1) (ω/Sqrt[λ] - Sqrt[λ]z);
{{σn[M, λ, ω],(-1-I)c/2}.ParabolicCylinderD[{-k,k-1},{ξ,I ξ}],
{-(1-I)c σn[M, λ, ω]/2,1}.ParabolicCylinderD[{-k - 1, k}, {ξ, I ξ}]}.
Conjugate[{{σn[M, λ, ω],(-1-I)c/2}.ParabolicCylinderD[{-k,k-1},{ξ,I ξ}],
{-(1-I)c σn[M, λ, ω]/2,1}.ParabolicCylinderD[{-k - 1, k}, {ξ, I ξ}]}]
integral =
N[Table[Integrate[
integrand[2, 100, ω, z], {z, -1/2, 1/2}], {ω,
roots}]]
Thanks!
NIntegrate[]instead? You don't have exact values for the roots, so you might as well just do numerical quadrature. – J. M.'s missing motivation Jun 26 '15 at 15:07