Discussion:
question about the inverse li function
(too old to reply)
Carl K. Woll
2006-03-29 12:02:53 UTC
Permalink
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
Bill Rowe
2006-03-29 12:06:56 UTC
Permalink
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] ?
Yes, there is a function for computing inverses of functions, InverseFunction. But, function will only provide and inverse function where there is a defined inverse function. That is,

InverseFunction[Sin] gives

ArcSin

but

InverseFunction[LogIntegral] won't give you something useful.

One way to solve the problem would be to use FindRoot, i.e.

In[10]:=
FindRoot[LogIntegral[x] == -1, {x, 1.1}]

Out[10]=
{x -> 1.1882560662743253}

or if you wanted the other root

In[16]:=
FindRoot[LogIntegral[x] == -1, {x, 0.9}]

Out[16]=
{x -> 0.7674077436558667}
--
To reply via email subtract one hundred and four

Continue reading on narkive:
Loading...