# method to eliminate NIntegrate warning.

• To: mathgroup@smc.vnet.net
• Subject: [mg10537] method to eliminate NIntegrate warning.
• From: "Soo-Hwan Kim" <kss@ssel.snu.ac.kr>
• Date: Tue, 20 Jan 1998 02:23:23 -0500
• Organization: Seoul National University, Republic of Korea

```I want to know the method to eliminate NIntegrate warning.

The two warning message follows :

NIntegrate::slwcon:
Numerical integration converging too slowly; suspect one of the
following: singularity, oscillatory integrand, or insufficient
WorkingPrecision.
NIntegrate::ncvb:
NIntegrate failed to converge to prescribed accuracy after 7
recursive bisections in x near x = 0.126684.

How can I escape from this problem ? When above-case happened, can I
believe the accuracy of my data ?

The two file which I used follows :

/********* program.ma file *************/

Result1=0;
m=9.11*10^-31;
e=1.60*10^-19;
Energy=0.5;
h=1.05458*10^-34;
Kx=(2*m*10^3*e*Energy)^(.5)/h;
num=Length[data];
For[i=1,i<=num,i++,
phase[i]=data[[i]];
Print[phase[i]];
]
f1[x_]=Sum[(2*i+1)*(Cos[2*phase[i+1]]-1)*LegendreP[i,Cos[x]],{i,0,num-1}];
f2[x_]=Sum[(2*i+1)*(Sin[2*phase[i+1]])*LegendreP[i,Cos[x]],{i,0,num-1}];
f3[x_]=f1[x]^2+f2[x]^2;
Kxx=1/(4*Kx^2);
Result=NIntegrate[f3[x]*Sin[x],{x,0,Pi}]; fil=OpenAppend["b.dat"];
Write[fil,2*3.141592*Kxx*Result];
For[c=1,c<=180,c++,
Print[c];
Result2=NIntegrate[f3[x]*Sin[x],{x,Pi/(180)*(c-1),Pi/(180)*c}
,MaxRecursion->0,AccuracyGoal->5];(* -> <<<Here : Warning Message>>>
*)
Result1+=Result2;
Write[fil,c,th,Result1/Result];

];
Close[fil];

/*************************************************/ /************ a.dat
file *************************/ 1.979491
1.319515
0.982686
0.773772
0.629903
0.524447
0.443828
0.380382
0.329298
0.287393
0.252482
0.223068
0.198016
0.176466
0.157811
0.141543
0.127341
0.114742
0.103576
0.093683
0.084864
0.076986
0.069930
0.063593
0.057875
0.052729
0.048075
0.043868
0.040043
0.036578
0.033437
0.030579
0.027981
0.025615
0.023461
0.021493
0.019704
0.018068
0.016574
0.015209
0.013952
0.012819
0.011767
0.010813
/*********************************/

```

• Prev by Date: Re: Impossible?
• Next by Date: Re: Is there a 3.01 student version?
• Prev by thread: RE: Re[a + I b] = a
• Next by thread: a simple algebraic system of 5 eqns second degree