r - Obtain inverse function analytically instead of numerically -


i implemented

> inverse = function (f, lower = -100, upper = 100) {    function (y) uniroot((function (x) f(x) - y), lower = lower, upper = upper)[1] }  > square_inverse = inverse(function (x) x^2, 0.1, 100)  > square_inverse(4) [1] 1.999976 

from solving inverse of function in r , happy worked :) despite visible in origin solution unfortunately not analytic one. there way exact solution or @ least improve approximation of above code?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -