I have a non-increasing function $f$ on $\mathbb R_+$ that starts at $f(0) =1$ and ends up at $f(Inf) = 0$. I want to compute the inverse of the function, and I am currently using the folowing code:
f_inv(y) = find_zero(x -> f(x) - y,(0,Inf))
Then i am repetitively calling this inversion as, e.g, :
samples = rand(1e6)
f_inv.(samples)
Would it be possible to reduce the cost of subsequent evaluations ? I guess that, since this is using a bisection method, we could re-start each iteration using the previous bisection. Is there something like that implemented in Roots.jl ?
I have a non-increasing function$f$ on $\mathbb R_+$ that starts at $f(0) =1$ and ends up at $f(Inf) = 0$ . I want to compute the inverse of the function, and I am currently using the folowing code:
Then i am repetitively calling this inversion as, e.g, :
Would it be possible to reduce the cost of subsequent evaluations ? I guess that, since this is using a bisection method, we could re-start each iteration using the previous bisection. Is there something like that implemented in Roots.jl ?