# Trouble finding inverse of a function

I have the following Mathematica code:

f[U_] = 1 - (Un/U)^3;

Un = 1;

L[Us_] := 3 NIntegrate[
Us^(5/2)/U^(3/2) Sqrt[f[Us]/f[U]] 1/
Sqrt[U^5 f[U] - Us^5 f[Us]], {U, Us, Infinity}]

UsvsL = Table[{Us, L[Us]}, {Us, 1.01, 2.01, 0.01}]


I am trying to find Us as a function of L or Us[L], for which I tried InverseSeries:

l[Us_] =
Integrate[
Series[Us^(5/2)/U^(3/2) Sqrt[f[Us]/f[U]] 1/
Sqrt[U^5 f[U] - Us^5 f[Us]], {U, 0, 4}], U]

Us1 = InverseSeries[l[Us], l] // PowerExpand // Simplify


but, to no avail. I need a table of LvsUs where I can vary the L values to obtain the corresponding Us values. Any help in this regard would be truly beneficial!

Look at your data:

ListLinePlot[UsvsL, AxesLabel -> {"U", "L"}]


Note that for some Ls there two Us. Therefore the inverse function is not single valued. We therefore create two inverse functions, One with the data from U= 1.01 .. 1.21 and a second one with data from U= 1.21 .. 2.01.

dat1 = Select[UsvsL, #[[1]] <= 1.21 &];
dat2 = Select[UsvsL, #[[1]] >= 1.21 &];


Now, how to create the inverse funtions? We already have a table of L[Us]. If we reverse the table entries, we have a table Us[L], but maybe not for the requested L. Toward this aim, we can calculate an interpolating function.

intpol1 = Interpolation[Reverse /@ dat1]
intpol2 = Interpolation[Reverse /@ dat2]


With this two functions you may get the Us for given Ls:

Plot[intpol1[l], {l, Min[dat1[[All, 2]]], Max[dat1[[All, 2]]]},
AxesLabel -> {"L", "U"}]
Plot[intpol2[l], {l, Min[dat2[[All, 2]]], Max[dat2[[All, 2]]]},
AxesLabel -> {"L", "U"}]


• Thank you for the answer! I just have one small doubt. How can I create the two tables from the above interpolating functions? Sep 26 at 13:31
• That is easy. If you want the U value to a certain L value you say e.g. : interpol1[L]. For a whole table: Table[interpol1[x],{x,xmin,xmax, xdelta}]. Note to take care that xmin and xmax are not outside the definition range, otherwise you may get arbitrary results. Sep 26 at 14:56