Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate

*To*: mathgroup at smc.vnet.net*Subject*: [mg93427] Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate*From*: er <erwann.rogard at gmail.com>*Date*: Fri, 7 Nov 2008 06:01:53 -0500 (EST)*References*: <geuc4r$fk5$1@smc.vnet.net>

On Nov 6, 4:07 am, Bill Rowe <readn... at sbcglobal.net> wrote: > On 11/5/08 at 4:57 AM, erwann.rog... 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. Thank you. What was said above would suffice if I were only concerned with a small finite subsets of values of t. The larger problem, however, as I hinted in the first post, is FindRoot[g[t]==0.25,{t,-1,1}]. If Mathematica cannot compute g[t], I can forget about FindRoot altogether. I hope not, and that someone has a better grasp of Mathematica than I have who can help.