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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -