Re: question about the inverse li function
- To: mathgroup at smc.vnet.net
- Subject: [mg65379] Re: [mg65348] question about the inverse li function
- From: "Carl K. Woll" <carlw at wolfram.com>
- Date: Wed, 29 Mar 2006 06:34:18 -0500 (EST)
- References: <200603280905.EAA26284@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Capet Arthur wrote: > the question... > > i've measured C(x), wich is equal to li(I(x)), where li denotes the > logarithmic integral function. I would like to compute I(x)= li^(-1) > (C(x)) > > how can i compute the inverse of the logarithmic integral function ? > Is there a function Inverse[_function] ? > > thanx a lot > > > Arthur Capet, ULG, Belgium > > Arthur, There is the function InverseFunction. For example: In[1]:= InverseFunction[Sin] Out[1]= ArcSin Unfortunuately, Mathematica does not have a built in function for the inverse of LogIntegral: In[2]:= InverseFunction[LogIntegral] Out[2]= InverseFunction[LogIntegral] So, we'll have to work harder to figure out the inverse. This question has come up on mathgroup before, with 3 basic possibilities: 1. Plot LogIntegral[x] and then extract the plot points. Use Interpolation to construct an InterpolatingFunction using these plot points. 2. Use FindRoot to find the inverse at a bunch of points, and then use Interpolation. 3. Use homotopic continuation. That is, find the inverse of LogIntegral at some point x, and then construct an ODE to determine how the inverse varies as x varies. I am usually the person advocating method 3. I'll show you how it works in your example. First, form the equation for the inverse x[y]: eqn = y == LogIntegral[ x[y] ] Now, construct an ODE satisfied by the inverse, x: In[4]:= D[eqn,y] Out[4]= x'[y] 1 == --------- Log[x[y]] The next step is to use NDSolve on this ODE, and so we need an initial value. However, the inverse is multivalued for negative input, since LogIntegral ranges from 0 to -Infinity as x goes from 0 to 1, and then LogIntegral ranges from -Infinity to Infinity as x goes from 1 to Infinity. So, we'll need to construct two inverses: one for 0<x<1 and one for 1<x<Infinity. For 0<x<1 we'll use the initial value x[LogIntegral[1/2]]==1/2 and for 1<x<Infinity we'll use x[LogIntegral[2]]==2 Now we are ready to use NDSolve. low = x /. NDSolve[{D[eqn, y], x[LogIntegral[1/2]] == 1/2}, x, {y, -5, 5}][[1]]; high = x /. NDSolve[{D[eqn, y], x[LogIntegral[2]] == 2}, x, {y, -5, 5}][[1]]; Some tests: In[7]:= LogIntegral[high[2]] LogIntegral[high[-2]] LogIntegral[low[-2]] Out[7]= 2. Out[8]= -2. Out[9]= -2. As you may have noticed, I used the range -5<y<5. You can change this range to whatever you need. Also, as I pointed out earlier, there are no real values of x on the low branch for which LogIntegral[x] is positive. There are complex values, but the branch chosen by my implementation doesn't agree with the branch used by Mathematica for LogIntegral: In[10]:= LogIntegral[low[1]] Out[10]= 1. + 3.14159 I Finally, we can use low or high to answer your question: i[x_] := low[ C[x] ] or i[x_] := high[ C[x] ] Carl Woll Wolfram Research
- References:
- question about the inverse li function
- From: "Capet Arthur" <Arthur.Capet@student.ulg.ac.be>
- question about the inverse li function