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

• To: mathgroup at smc.vnet.net
• Subject: [mg93416] Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate
• From: er <erwann.rogard at gmail.com>
• Date: Fri, 7 Nov 2008 05:59:52 -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.

ps:

by way of comparison, for a function the same form as that of f[x],
but with different coefficients:

(-0.6125690184109311*E^(2.632*x) + E^(1.316*x)*(0.9479322653056199 -
0.35315008133457504*x))/(12.211658515186215 +
7.183003345050428*E^(1.316*x) + E^(2.632*x))

Mathematica has no problem computing g[t] and FindRoot[...], yielding
{t->-0.00756071}

```

• Prev by Date: Re: From reactions to differential equations
• Next by Date: Re: Tooltip ans Sound - 2nd posting
• Previous by thread: Re: Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate
• Next by thread: Re: NIntegrate[UnitStep[...]PDF[...],{x,...}] hard to integrate