Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16655 > unrolled thread

NIntegrate and double integral -- very slow

Started bybluesaturn <bluesaturn.at.kellnerweg.de@gmail.com>
First post2014-03-15 07:52 +0000
Last post2014-03-17 06:26 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  NIntegrate and double integral -- very slow bluesaturn <bluesaturn.at.kellnerweg.de@gmail.com> - 2014-03-15 07:52 +0000
    Re: NIntegrate and double integral -- very slow "Kevin J. McCann" <kjm@KevinMcCann.com> - 2014-03-17 06:26 +0000

#16655 — NIntegrate and double integral -- very slow

Frombluesaturn <bluesaturn.at.kellnerweg.de@gmail.com>
Date2014-03-15 07:52 +0000
SubjectNIntegrate and double integral -- very slow
Message-ID<lg10rm$517$1@smc.vnet.net>
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}]

[toc] | [next] | [standalone]


#16659

From"Kevin J. McCann" <kjm@KevinMcCann.com>
Date2014-03-17 06:26 +0000
Message-ID<lg64j9$gl8$1@smc.vnet.net>
In reply to#16655
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}]
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web