How can I get this section of the code to solve this integration faster. I have rather large values but I don't need it to be too specific. However if I lower the precision it says the integration is 0. The function is only in a very small section of the x values according to the 3d plot. However if I analyze the smaller section it still takes a considerable amount of time. Any help is appreciated
timewj2 = AbsoluteTiming[
Wjlambda5 = (1/8.952*10^8)*
NIntegrate[
Dot[Re[{0, -8.952*10^8*(15.675459922348419449)*(((-8.\
9652950534407867999303353030387276032035253437793*10^768 -
2.1141452007443239580927869423477693294460547800052\
7*10^769*I)*
BesselJ[
1, (75062.4870217452581789128 +
75062.4983440564559965704*I )*
x] + (2.1141452007443239580927869423477693294*10^\
769 - 8.965295053440786799930335303038727603*10^768*I)*
BesselY[
1, (75062.4870217452581789128 +
75062.4983440564559965704*I )*x])*
Exp[I*(1)*(41.2281675906100480252)*s]), 0}],
Re[{0, -8.952*10^8*(15.675459922348419449)*(((-8.\
9652950534407867999303353030387276032035253437793*10^768 -
2.1141452007443239580927869423477693294460547800052\
7*10^769*I)*
BesselJ[
1, (75062.4870217452581789128 +
75062.4983440564559965704*I )*
x] + (2.1141452007443239580927869423477693294*10^\
769 - 8.965295053440786799930335303038727603*10^768*I)*
BesselY[
1, (75062.4870217452581789128 +
75062.4983440564559965704*I )*x])*
Exp[I*(1)*(41.2281675906100480252)*s]), 0}]]*
x, {x, (0.02357124714249428777766010023597686995), \
(0.04022197675031113473009371147375231401)}, {s,
0, (0.15240030480060962059241091992589645088)},
WorkingPrecision -> (2000 - 1), MaxPoints -> 80];
];
Print["Time Wj5 (s) = ", N[timewj2[[1]],10]];
EDIT: Like This?
prec = 100;
σ5 = SetPrecision[500*(1.492*^6), prec];
vs5 = SetPrecision[15.675459, prec];
γ5 = SetPrecision[75062.487021745, prec];
e = SetPrecision[-8.965295053440786799*10^768 -
2.1141452007443239588*10^769*I, prec];
j = SetPrecision[
2.1141452007443239580927*10^769 - 8.96529505344078679*10^768*I,
prec];
mm = SetPrecision[1, prec];
k = SetPrecision[41.2281675, prec];
r45 = SetPrecision[0.02357124714249428777766010, prec];
r56 = SetPrecision[0.0402219767503111347300937114, prec];
lam = SetPrecision[.1524, prec];
timewj2 = AbsoluteTiming[
Wjl5 = (1/σ5)*
NIntegrate[
Dot[
Re[{0, -σ5* vs5*((e*BesselJ[1, γ5*x] + j*BesselY[1, γ5*x])*Exp[I*mm*k*s]), 0}],
Re[{0, -σ5* vs5*((e*BesselJ[1, γ5*x] + j*BesselY[1, γ5*x])*Exp[I*mm*k*s]), 0}]
]*x,
{x, r45, r56},
{s, 0, lam},
WorkingPrecision -> prec - 1,
MaxPoints -> 80
];
];
Wjl5
Print["Time Wj5 (s) = ", N[timewj2, prec2]];
But my output is still wrong its getting 1.02*10^1542 and the answer is close to 0 but not 0.
SetPrecision
notwithstanding. I advise doing what I suggested in my 1st comment: re-expressing all the arithmetic quantities at a modest precision, say 20, and working strictly at that precision in your calculations. Also, I don't know what you are referring to when you mention "3rd plot". You show no plots. Further, plotting doesn't require high precision; it's always done at machine precision. $\endgroup$Dot[Re[{0,-σ5*vs5*((e*BesselJ[1,γ5*x]+j*BesselY[1,γ5*x])*Exp[I*mm*k*s]),0}], Re[{0,-σ5*vs5*((e*BesselJ[1,γ5*x]+j*BesselY[1,γ5*x])*Exp[I*mm*k*s]),0}]]*x
==x*Re[-σ5*vs5*((e*BesselJ[1,γ5*x]+j*BesselY[1,γ5*x])*Exp[I*mm*k*s])]^2
and that might make your code smaller and a little faster. Check to make certain this is correct. $\endgroup$