Elliptic integral trouble in Mathematica...
- To: mathgroup at yoda.physics.unc.edu (Mathematica user group)
- Subject: Elliptic integral trouble in Mathematica...
- From: squash at msri.org (Jonathan King)
- Date: Mon, 9 Mar 92 17:53:06 PST
Hello. Can you help me, or refer me to someone who can help, with the following difficulty? I'm hoping that a certain ratio of integrals, line In[14] below, can be expressed as an algebraic formula in "F" and "P", even though most probably neither integral has an elementary antiderivative. However, it appears that Mathematica is computing an erroneous numerator. Numerical integration, however, produces a more plausible result. However, it is the theoretical result that I need. Jonathan King, squash at msri.org ================================================================ Mathematica 2.0 for SPARC Copyright 1988-91 Wolfram Research, Inc. -- X11 windows graphics initialized -- In[1]:= $Version Out[1]= SPARC 2.0 (August 26, 1991) In[2]:= P = 1/2 1 Out[2]= - 2 In[3]:= F = 1/5 1 Out[3]= - 5 In[4]:= Integrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,P,1}] 4 Out[4]= 2 EllipticK[-(--)] 25 In[5]:= N[%] Out[5]= 3.02612 in[6]:= (* Now do same integral numerically, directly. A different value will come out. *) In[7]:= NIntegrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,P,1}] Out[7]= 1.98604 In[8]:= (* This is way off from "3.02612" up above. Now I change the value of P. *) In[9]:= P = 99 / 100 99 Out[9]= --- 100 In[10]:= Integrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,P,1}] 400 100 EllipticK[-(----)] 9801 Out[10]= ---------------------- 99 In[11]:= N[%] Out[11]= 1.57084 In[12]:= NIntegrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,P,1}] Out[12]= 0.140156 In[13]:= (* What I am actually interested in is the ratio below. The numerator integrates from P to 1. The denominator integrates from 0 to 1. Let's do it symbolically, then theoretically. *) In[14]:= Integrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,P,1}] / Integrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,0,1}] Out[14]= 1 In[15]:= (* Now, numerically. *) In[16]:= NIntegrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,P,1}] / NIntegrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,0,1}] Out[16]= 0.0892241 In[17]:= (* Way off. What to do? Lets manually alter the limits of integration. *) In[18]:= Integrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,P,1}] 400 100 EllipticK[-(----)] 9801 Out[18]= ---------------------- 99 In[19]:= N[%] Out[19]= 1.57084 In[20]:= Integrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,1/9,1}] 400 100 EllipticK[-(----)] 9801 Out[20]= ---------------------- 99 In[21]:= N[%] Out[21]= 1.57084 In[22]:= Integrate[1/Sqrt[(1-x^2)(P^2 + (F^2)x^2)], {x,8/9,1}] 400 100 EllipticK[-(----)] 9801 Out[22]= ---------------------- 99 In[23]:= N[%] Out[23]= 1.57084 (* No change in result, even when I alter the lower limit from "1/9" to "8/9". Yet the integrand is strictly positive. *)