# Weirdness with Interpolation of data and InverseFunction

Bug introduced in 8 or earlier and persisting through 13.1.0

Something strange is happening with this list of data:

list={{1., 1.62253*10^9}, {1.5, 1.36608*10^9}, {2., 1.13736*10^9}, {2.5,
9.44041*10^8}, {3., 7.82907*10^8}, {3.5, 6.49117*10^8}, {4.,
5.38152*10^8}, {4.5, 4.46147*10^8}, {5., 3.6987*10^8}, {5.5,
3.06633*10^8}, {6., 2.54208*10^8}, {6.5, 2.10746*10^8}, {7.,
1.74714*10^8}, {7.5, 1.44843*10^8}, {8., 1.20079*10^8}, {8.5,
9.95493*10^7}, {9., 8.25292*10^7}, {9.5, 6.84191*10^7}, {10.,
5.67215*10^7}, {10.5, 4.70237*10^7}, {11., 3.8984*10^7}, {11.5,
3.23189*10^7}, {12., 2.67933*10^7}, {12.5, 2.22124*10^7}, {13.,
1.84148*10^7}, {13.5, 1.52664*10^7}, {14., 1.26563*10^7}, {14.5,
1.04924*10^7}, {15., 8.69852*10^6}, {15.5, 7.21132*10^6}, {16.,
5.9784*10^6}, {16.5, 4.95627*10^6}, {17., 4.10889*10^6}, {17.5,
3.40639*10^6}, {18., 2.824*10^6}, {18.5, 2.34117*10^6}, {19.,
1.9409*10^6}, {19.5, 1.60906*10^6}, {20., 1.33396*10^6}, {20.5,
1.10589*10^6}, {21., 916817.}, {21.5, 760068.}, {22.,
630118.}, {22.5, 522387.}, {23., 433074.}, {23.5, 359031.}, {24.,
297647.}, {24.5, 246758.}, {25., 204570.}, {25.5, 169594.}, {26.,
140598.}, {26.5, 116560.}, {27., 96631.8}, {27.5, 80110.6}, {28.,
66414.}, {28.5, 55059.1}, {29., 45645.6}, {29.5, 37841.5}, {30.,
31371.7}, {30.5, 26008.}, {31., 21561.4}, {31.5, 17874.9}, {32.,
14818.7}, {32.5, 12284.9}, {33., 10184.1}, {33.5, 8442.19}, {34.,
6997.53}, {34.5, 5798.9}, {35., 4803.48}, {35.5, 3975.26}, {36.,
3283.38}, {36.5, 2700.58}, {37., 2201.3}, {37.5, 1759.49}, {38.,
1347.12}, {38.5, 944.464}, {39., 592.687}, {39.5, 359.675}, {40.,
218.154}, {40.5, 132.317}, {41., 80.2543}, {41.5, 48.6767}, {42.,
29.5239}, {42.5, 17.9072}, {43., 10.8612}, {43.5, 6.58768}, {44.,
3.99563}, {44.5, 2.42347}, {45., 1.46991}, {45.5, 0.891545}, {46.,
0.54075}, {46.5, 0.327981}, {47., 0.198931}, {47.5, 0.120658}, {48.,
0.0731825}, {48.5, 0.0443874}, {49., 0.0269223}, {49.5,
0.0163292}, {50., 0.00990417}, {50.5, 0.00600718}, {51.,
0.00364354}, {51.5, 0.00220992}, {52., 0.00134038}, {52.5,
0.000812984}, {53., 0.0004931}, {53.5, 0.00029908}, {54.,
0.000181401}, {54.5, 0.000110025}, {55., 0.0000667338}, {55.5,
0.0000404761}, {56., 0.00002455}, {56.5, 0.0000148903}, {57.,
9.03144*10^-6}, {57.5, 5.47784*10^-6}, {58., 3.32248*10^-6}, {58.5,
2.01519*10^-6}, {59., 1.22227*10^-6}, {59.5, 7.41345*10^-7}, {60.,
4.49649*10^-7}}


If I interpolate them with

T = Interpolation[list]


I get a nice decreasing function, which behaves like

LogPlot[T[b], {b, 1, 60}, AxesLabel -> {"b", "T"}]


The problems begin when I try to define the inverse of T as

b = InverseFunction[T]


because when I evaluate it from 10^-7 up to 10^5 everything is right, as the following graph shows,

but at the orders of magnitude 10^6, 10^7 and 10^8 it fails and gives simply (e.g. for the 10^6 case)

Moreover, around 10^9 it starts again giving the right values (around 2).

What could be the issue?

• Looks like a bug. Especially suspicious is that addition of InterpolationOrder -> 1 doesn't solve the problem. Sep 11, 2019 at 17:43
• A bug? Oh dear.. I am using Mathematica 12.0 Student Edition, I don't know if it can help...
– Lele
Sep 11, 2019 at 17:47
• One workaround is to start from the inverse problem: b = Interpolation[Reverse /@ list]; T = InverseFunction[b];. Then everything works as expected. I recommend reporting the original problem to the support though. Of course, this approach isn't equivalent to the original and could provide identical results only for InterpolationOrder -> 1. Sep 11, 2019 at 17:50
• Oh wonderful! Thank you very much! How can I report the problem? I think that the order of interpolation is nice with 1.
– Lele
Sep 11, 2019 at 17:56
• You can go to Help > Give Feedback... in Mathematica or just write a letter to support at wolfram.com. Sep 11, 2019 at 17:58

This is a bug in InverseFunction. Even addition of InterpolationOrder -> 1 to Interpolation doesn't solve the problem.

The function values are all machine numbers, contain no duplicate points and are strictly decreasing as easily can be seen from Sign[Differences /@ Transpose[list]]. It is a shame that that Mathematica fails for such a basic task.

One workaround is to start from the inverse problem:

b = Interpolation[Reverse /@ list]; T = InverseFunction[b];


Then everything works as expected. Of course, this approach isn't equivalent to the original and could provide identical results only for InterpolationOrder -> 1. I recommend reporting the original problem to the support.

Here is a minimal code snippet reproducing the issue:

list = {{20., 1.3*^6}, {20.5, 1.1*^6}, {21., 920000.}, {21.5, 760000.}};
int = Interpolation[list];
if = InverseFunction[int];
if[1*^6]


The inverse function returns unevaluated even for int = Interpolation[list, InterpolationOrder -> 1]`.