Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate
- To: mathgroup at smc.vnet.net
- Subject: [mg93410] Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 6 Nov 2008 04:07:49 -0500 (EST)
On 11/5/08 at 4:57 AM, erwann.rogard at gmail.com (er) wrote: >f[x_]=(0.014999775454701741*E^(5.264*x) + >E^(2.632*x)*(-0.012692488700608462 - 0.14964297032258167*x))/ >(12.579644604014753 + 7.102251209677398*E^(2.632*x) + E^(5.264*x)) >g[t_]:=NIntegrate[ UnitStep[t-f[x]] PDF[ >NormalDistribution[0,1/2],x], {x,-Infinity,Infinity} ] >g[0] runs for a very long time before forcing the kernel to quit, >let alone FindRoot[g[t]==0.25,{t,-1,1}] >Note that f[x]PDF[NormalDistribution[0,1/2],x] integrates to 0 and i >virtually zero outside [-2,2] >I use Mathematica 5.2/Ubuntu/4GB/IntelCoreDuo2 >any recommandation? I wonder if you have defined g as you intended. A plot of f[x] shows it everywhere positive except the interval from 0 to ~.8. This can be refined by doing In[8]:= FindRoot[f[x], {x, .8}] Out[8]= {x->0.84719} So, UnitStep[t-f[x]] will be 0 outside this interval when t = 0. This means g[0] amounts to integrating the PDF of a normal distribution from 0 to .84719. For any distribution the integral of the PDF is the CDF. The median of NormalDistribution[0,a] is 0. So, g[0] must be In[10]:= CDF[NormalDistribution[0, 1/2], .84719] - .5 Out[10]= 0.454903 The way you have set the problem up, you are asking Mathematica to do a lot more work than is needed to solve the problem.
- Follow-Ups:
- Re: Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate
- From: "peter lindsay" <plindsay@mcs.st-and.ac.uk>
- Re: Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate