Home > Mobile >  Approximating the inverse of a unknown function
Approximating the inverse of a unknown function

Time:11-04

Suppose you have a function that you don't know in its analytic form. You just have have a very large number of sampled values:f(0), f(u1), f(u2), ....f(2*Math.PI) within the range [0,2*Math.PI].

Is there a method to compute approximations for some samples values for the inverse of f?

CodePudding user response:

Methods can have any arbitrary logic they choose to have, and there is no way to know which cases behave differently without either knowing the implementation or testing literally every possible input value.

More generally, in the case where you don't know the function's purpose, you can't even know what the relation between the input and the output is; so it is impossible to know how to connect one to the other, let alone figure out its inverse.

I suspect you may have been interested more in a mathematical concept than a programming one; but this is not the right place for that question.

CodePudding user response:

If the f function is unknown, then you basically have a set of (x,f(x)) points you can use for some interpolation or curve fitting. Hard to tell how good the approximation will be without having more context about your problem.

If you're looking for the inverse, just swap x and f(x) values and do the same.

  • Related