inversefunction-approximation

Evaluating the inverse of a function


I need to evaluate the inverse of this function in the domain [0,1):function to invert

There is an analytic inverse (which I won't bother putting here as it's quite big), but it only works for a limited range of the constant A, i.e. if A>0.385f(x). Then, I thought of two possible solutions:

  1. Use Newton-Raphson method (or any other root-finding method) to evaluate the x for each f(x);
  2. Approximate the inverse with a sigmoid function and determine the parameters through least-squares.

I am tending towards (2), since it seems simple enough and doesn't slow down my code, as (1) might, but I'm insecure about the validity of the approximation. I'd also appreciate other suggestions.

My code is in C++, if there is some built-in way of solving my problem.


Solution

  • Although both proposed methods you suggested are interesting for more general cases, this function can be inverted analytically.

    In Mathematica you probably inverted it and got this "wrong" answer:

    "wrong" answer

    The correct real answer is the absolute value of this due to the squareroot.

    Here is a plot to illustrate this "right" answer works:

    "right" answer