Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Use FindRoot in NIntegration' topicStudent Support Forum > General > Archives > "Use FindRoot in NIntegration"

Next Comment >Help | Reply To Topic
Author Comment/Response
Wood Du
06/18/07 01:38am

Hi, everyone,

I have some questions about using FindRoot and NIntegrate together. I try to do a numerical integration, but, a paramenter of the integrand must be obtained by numerically solving a equation.

I paste my code in the following. In the code, "epsl" is the parameter which needs to be solved numerically first. However, I get the message telling me the calculation converges slowly when I run the code.

When I change the method for Nintegrateion to "Mentocalo", the system gives me the result. But, the speed is still slow and the result seems incorrect (I ever wrote a Mento Carlo simulation for this integration using other language, and the simulation did converge.)

Can anybody tell me whether there is a better/fast way to do such kind integrations? Or, is there any severe problems in my codes?

Thanks a lot!

Best Regards

Wood Du



Clear["`*"]; gbar1 = 1; gbar2 = 1; bete = 1;

sumalfa[gama1_?NumericQ, gama2_?NumericQ, epsl_?NumericQ] =
Max[0, -(1 - Log[bete gama1]/(
1 + ProductLog[(-1 + epsl gama1)/\[ExponentialE]]))/bete] +
Max[0, -(
1 - Log[bete gama2]/(
1 + ProductLog[(-1 + epsl gama2)/\[ExponentialE]]))/bete];

integrand[gama1_?NumericQ,
gama2_?NumericQ] := (ep =
epsl /. FindRoot[
sumalfa[gama1, gama2, epsl] == 1, {epsl, 0.0003, 0, Infinity}];
1/(gbar1 gbar2) (\[ExponentialE]^(-gama1/gbar1 - gama2/
gbar2) ((-1 + \[ExponentialE]^(
1 + ProductLog[(-1 + ep gama1)/\[ExponentialE]]))/gama1*
Max[0, -(
1 - Log[bete gama1]/(
1 + ProductLog[(-1 + ep gama1)/\[ExponentialE]]))/
bete] + (-1 + \[ExponentialE]^(
1 + ProductLog[(-1 + ep gama2)/\[ExponentialE]]))/gama2*
Max[0, -(
1 - Log[bete gama2]/(
1 + ProductLog[(-1 + ep gama2)/\[ExponentialE]]))/
bete])));

NIntegrate[
integrand[gama1, gama2], {gama1, 1/bete, Infinity}, {gama2, 1/bete,
Infinity}]

URL: ,

Subject (listing for 'Use FindRoot in NIntegration')
Author Date Posted
Use FindRoot in NIntegration Wood Du 06/18/07 01:38am
Re: Use FindRoot in NIntegration yehuda ben-s... 06/18/07 11:22am
Re: Use FindRoot in NIntegration Wood Du 06/20/07 10:55pm
Re: Use FindRoot in NIntegration Peter Pein 06/25/07 09:15am
Re: Re: Use FindRoot in NIntegration Wood Du 06/27/07 10:42pm
Next Comment >Help | Reply To Topic