Re: ExpIntegralEi
- To: mathgroup at smc.vnet.net
- Subject: [mg18748] Re: [mg18463] ExpIntegralEi
- From: schnizer at itp.tu-graz.ac.at (B. Schnizer)
- Date: Sat, 17 Jul 1999 02:36:58 -0400
- Organization: TU-Graz
- References: <7m14pj$pli@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <7m14pj$pli at smc.vnet.net>, "Ersek, Ted R" <ErsekTR at navair.navy.mil> wrote: > Lionel ARNAUD reported the following with version 3.0. > ------------------------- > > c2 = -0.05018627683354541 - 0.153047656745338 I; > c3 = -0.7828709924214918 + 0.2780791279205129 I; > c5 = -0.6758555487562639 - 0.04753624179417532 I; > > Integrate[Exp[beta*c2+s*(c3+beta*c5)], {s,0,1},{beta,0,1}] > > NIntegrate[Exp[beta*c2+s*(c3+beta*c5)], {s,0,1},{beta,0,1}] > > The results given are: > -0.228103 + 10.5644 I > 0.587252 + 0.0191685 I > > Not the same ! > ---------------------- > Lionel, > > Version 4.0 gives the same result. I wonder if the difference has to due > with branch cuts along the path of integration. It may be that the two > commands are integrating along different paths in the complex plane. > > I think Exp[z] has a branch cut where Im[z]=(Pi+2*n*Pi) (n is an integer). > However it looks like the integration path doesn't cross a branch cut, so I > am puzzled. > > Regards, > Ted Ersek Ted Ersek is right; the crossing of the branch cut of ExpIntegralEi (extending from - Infinity to 0) is the reason that sometimes the results of numerical and analytical integrations disagree. I cut down the constants to shorter numbers still displaying the phenomenon. Indefinite analytic integration gives: In[1] := ai = Integrate[Exp[b*cc2+s*(cc3+b*cc5)],{s,0,1},{b,0,1}]//Expand Out[1] := -(ExpIntegralEi[cc2 + (cc2*cc3)/cc5]/ (E^((cc2*cc3)/cc5)*cc5)) + ExpIntegralEi[(cc2*cc3)/cc5]/(E^((cc2*cc3)/cc5)*cc5) - ExpIntegralEi[(cc3*(cc2 + cc5))/cc5]/ (E^((cc2*cc3)/cc5)*cc5) + ExpIntegralEi[cc2 + cc3 + (cc2*cc3)/cc5 + cc5]/ (E^((cc2*cc3)/cc5)*cc5) The arguments of the ExpIntegralEi's are: In[2] := farg := {c2 + (c2*c3)/c5, (c2*c3)/c5, (c3*(c2 + c5))/c5, c2 + c3 + (c2*c3)/c5 + c5}; Set 1 gives agreeing results: In[3] := c2=-0.5 -0.12 I; c3=-0.8 +0.3 I; c5=-0.7 -0.052 I; In[4] := Integrate[Exp[b*c2+s*(c3+b*c5)],{s,0,1},{b,0,1}] Out[4] := 0.472708 + 0.0291867 I In[5] := Table[ai /. {cc2 -> c2,cc3 -> c3,cc5 -> c5} Out[5] := 0.472708 + 0.0291867 I In[6] := NIntegrate[Exp[b*c2+s*(c3+b*c5)],{s,0,1},{b,0,1}] Out[6] := 0.472708 + 0.0291867 I Set 2 gives disagreeing results: In[7] := c2=-0.5 -0.13 I; c3=-0.8 +0.3 I; c5=-0.7 -0.052 I; In[8] := Integrate[Exp[b*c2+s*(c3+b*c5)],{s,0,1},{b,0,1}] Out[8] := -2.59819 - 16.3074 I In[9] := ai /. {cc2 -> c2,cc3 -> c3,cc5 -> c5} Out[10] := -2.59819 - 16.3074 I In[11] := NIntegrate[Exp[b*c2+s*(c3+b*c5)],{s,0,1},{b,0,1}] Out[12] := 0.472769 + 0.0271254 I Note that the result of the numerical integration changes only slightly. The integrands are continuous functions. Two reasons to trust the results of the numerical integration. Now we look at the arguments and the values of the ExpIntegralEi's : Set 1 : In[13] := c2=-0.5 -0.12 I; c3=-0.8 +0.3 I; c5=-0.7 -0.052 I; In[14] := farg Out[14] := {-1.11374 + 0.00273495 I,-0.61374+0.122735 I, -1.41374 + 0.422735I, -2.61374+0.250735 I} In[15]:= Table[ai[[k]]/. {cc2 -> c2,cc3 -> c3,cc5 -> c5},{k,4}] Out[15]= {1.14749 + 8.19983 I, -0.466126-8.0542 I, 1.35286 + 7.98451 I,-1.56152-8.10095 I} Set 2 : In[16] := c2=-0.5 -0.13 I; c3=-0.8 +0.3 I; c5=-0.7 -0.052 I; In[17] := farg Out[17] := {-1.11885 - 0.0183143 I,-0.618846+0.111686 I, -1.41885 + 0.411686 I,-2.61885+0.229686 I} In[18]:= Table[ai[[k]]/. {cc2 -> c2,cc3 -> c3,cc5 -> c5},{k,4}] Out[18]= {-2.00158 - 8.06523 I,-0.387585-8.12648 I, 1.27058 + 8.0452 I,-1.4796-8.16085 I} Compare Out[14] to Out[17]: The imaginary part of the first number in the list changed sign. The corresponding values of the ExpIntegralEi's change vary much, compare the first numbers in Out[15] and Out[18]. B. Schnizer Email: schnizer at itp.tu-graz.ac.at