Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am attempting to integrate a convolution variable using the following code. However, the program is taking too long to complete the integration. Does anybody have any coding tips that may make this run faster?

convolutionIntegralinEveryone = 
     Mean[convolutionIntegralinEachIndividual];

plottingDistributionofIntervals = 
     ParametricPlot[{x/(2*Pi), convolutionIntegralinEveryone},
           {x, 0, longestDosingIntervalObserved*3}, AspectRatio -> Full, 
           PlotRange -> All]

plottingCumulativeDistributionofIntervals = ParametricPlot[{y/(2*Pi), 
   NIntegrate[convolutionIntegralinEveryone, {x, 0, y}, MinRecursion -> 4,
           AccuracyGoal -> 2]},
   {y, 0, longestDosingIntervalObserved*8}, AspectRatio -> Full, PlotStyle -> {Blue, Thick},
           PlotRange -> All]

The convolutionIntegalinEveryone is the mean of the convolution integrals in the all of the individuals (there are 100,000 simulated individuals with several intervals each) and the code is as follows:

convolutionIntegralinEachIndividual=Table[Sum[(1/totalCountofIntervalsEachIndivi‌​dual[[ii]])*distributionofIntervalsinEachIndividual[[ii,jj,2]]*diracVonmisesConvo‌​lution[[distributionofIntervalsinEachIndividual[[ii,jj,1]]+1]], {jj,1,Length[distributionofIntervalsinEachIndividual[[ii]]]}], {ii,1,Length[distributionofIntervalsinEachIndividual]}];

I would also like to add that the code has ran with other datasets containing different parameters.

share|improve this question
    
Without specifying the variable convolutionIntegralinEachIndividual the problem is not completely defined. Please specify. Regards, Wolfgang –  Dr. Wolfgang Hintze Jul 7 at 9:41
    
That will strongly depend on what is in convolutionIntegralinEveryone, which you have not specified. However, please try to give a minimal example if possible (rather than the entirety of the code, if it is long). Try to make it easy for the people answering to digest what the code does. –  acl Jul 7 at 11:04
    
The convolutionIntegalinEveryone is the mean of the convolution integrals in the all of the individuals (there are 100,000 simulated individuals with several intervals each) and the code is as follows: convolutionIntegralinEachIndividual=Table[Sum[(1/totalCountofIntervalsEachIndivi‌​dual[[ii]])*distributionofIntervalsinEachIndividual[[ii,jj,2]]*diracVonmisesConvo‌​lution[[distributionofIntervalsinEachIndividual[[ii,jj,1]]+1]], {jj,1,Length[distributionofIntervalsinEachIndividual[[ii]]]}], {ii,1,Length[distributionofIntervalsinEachIndividual]}]; –  Kelly Jul 7 at 16:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.