Using findroot and NIntegrate with a double integral
- To: mathgroup at smc.vnet.net
- Subject: [mg97770] Using findroot and NIntegrate with a double integral
- From: Mac <mwjdavidson at googlemail.com>
- Date: Sat, 21 Mar 2009 05:16:55 -0500 (EST)
Hello, I'm working on a typical compound distribution in radar scattering theory which involves the lognormal and gamma distribution. What I would like to do is calculate the uncertainty bounds (quantiles) for the compound distribution which can only be solved numerically. I'm hitting a problem with the combination of NIntegrate[] and FindRoot[] which requires the integration over two variables (s which needs to be integrated out) and (x the quantile). I get a lot of error messages complaining about undefined limits of integration. ------------------------------------ (1) Error Messages In[81]:= lognormpdf gammapdf Out[81]= (0.346517 E^(-0.377223 Log[s]^2))/s Out[82]= (316.228 E^(-((316.228 x)/s)))/s In[83]:= FindRoot[ NIntegrate[lognormpdf gammapdf, {s, 0, Infinity}, {x, 0, lowlim}] == 0.159, {lowlim, 0.001}] During evaluation of In[83]:= NIntegrate::nlim: x = lowlim is not a valid limit of integration. >> During evaluation of In[83]:= NIntegrate::inumr: The integrand (109.578 E^(-((316.228 <<6>>)/s)-0.377223 <<1>>))/s^2 has evaluated to non-numerical values for all sampling points in the region with boundaries {{\[Infinity],0.}}. >> During evaluation of In[83]:= NIntegrate::inumr: The integrand (109.578 E^(-((316.228 <<6>>)/s)-0.377223 <<1>>))/s^2 has evaluated to non-numerical values for all sampling points in the region with boundaries {{\[Infinity],0.}}. >> Out[83]= {lowlim -> 0.000339794} Many thanks for any help. Malcolm