Re: NIntegrate and double integral -- very slow
- To: mathgroup at smc.vnet.net
- Subject: [mg132439] Re: NIntegrate and double integral -- very slow
- From: "Kevin J. McCann" <kjm at KevinMcCann.com>
- Date: Mon, 17 Mar 2014 02:26:31 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <lg10rm$517$1@smc.vnet.net>
I would suggest that you plot the integrand to see if there are possible
problems/singularities. Also, in my email I have:
formfactorcounterionx[q_, alpha_, rcx_] :=
lengthcylinder*Sinc[q*alpha*lengthcylinder/2]*rhoPBsolvent*nx[rcx]*
BesselJ[0, q*rcx*Sqrt[1 â?? alpha^2]]*2*Pi*rcx;
with a funny symbol in the Sqrt at the end.
Kevin
On 3/15/2014 3:52 AM, bluesaturn wrote:
> Dear all
> I am trying to model something. This involves oscillating function
> (BesselJ0, BesselJ1) over that I have to integrate. An example is shown
> below.
> Mathematica is not able to manage to calculate the last three lines, not
> even overnight (12-14h). I don't think there is a simple analytical
> solution that is why I tried the numerical approach.
> How can I speed up the calculations, please? For example the line with
> the Table-Command. Ideally I would like to have more than just 26 points.
>
> Thank you for your feedback.
> Kind regards
> B.
>
>
>
>
> %%%%%%%%%%%%%%%%%%%%%%% Example code
>
> formfactorrodx[q_, alpha_] :=
> lengthcylinder*Sinc[q*alpha*lengthcylinder/2]*rhoRodcontrast*2*Pi*
> acylinder*BesselJ[1, q*acylinder*Sqrt[1 - alpha^2]]/(q*Sqrt[1 - alpha^2])
>
> nx[rcx_] := ((2*Abs[beta])/(kappanormal*rcx*Cos[beta*Log[rcx/RM]]))^2*
> nR0;
>
> formfactorcounterionx[q_, alpha_, rcx_] :=
> lengthcylinder*Sinc[q*alpha*lengthcylinder/2]*rhoPBsolvent*nx[rcx]*
> BesselJ[0, q*rcx*Sqrt[1 â?? alpha^2]]*2*Pi*rcx;
>
>
> intensityRodCounterions[q_?NumericQ] :=
> NIntegrate[
> 2*fp*formfactorcounterionx[q, alpha, rcx]*
> formfactorrodx[q, alpha], {rcx, acylinder, router}, {alpha, 0,
> 1 - chiint}, Method -> {"MonteCarlo", "MaxPoints" -> 10^10}];
>
>
> Table[intensityRodCounterions[1*10^(-1)*10^(9)*i], {i, 26}]
>
> ListLinePlot[
> Table[intensityRodCounterions[q], {q, 1*^-1*1*^9, 2.6*1*^9, 26}]]
>
> LogLogPlot[intensityRodCounterions[q], {q, 1*^-1*1*^9, 2.6*1*^9}]
>