Hi. This is my first thread topic and question ever posting here.

I have the following function and the my goal is to find a solution of x to make it zero.

f(x, y) = (x^0.5 - y)/(1-x) - x^(-0.5);

Can I find the solution x^\star as a function of y such that x^\star = g(y)? I need this to plug x^\star = g(y) into another equation of y to maximize so that the final solution x^\star can be found afterwards.

I guess βfind_zeroβ function from Roots.jl cannot work in this case since the function is not univariate.

Set the equation f(x, y) = 0, multiply by 1-x, reorder, let u = \sqrt{x}, solve the quadratic equation in u and recover x > 0. Thereβs probably some conditions on y for the solution to exist.

I actually suggested to solve for x, not for y
I found x = \frac{(y + \sqrt{y^2 + 8})^2}{16} (we keep only the positive root because x > 0). We also have x \neq 1, therefore you canβt have y = 1 (it implies x = 1).

Here is a way of using Roots to get a solution (perhaps not as performant as solving the equation algebraically):
(using DNFβs suggestion to replace ^0.5 with sqrt)

using Roots
f(x,y) = (sqrt(abs(x)) - y)/(1-x) - 1/sqrt(abs(x));
G(y) = x -> f(x,y)
X(y) = find_zero(G(y),0.1)

Admittedly, there is a problem with the 0.1 initial guess to find_zero. One solution would be to use find_zeros from Roots package, with a known good interval. Or to use this interval in find_zero with a different root finding method (i.e. Bisection). Something like:

julia> X(y) = minimum((abs(x),x) for x in find_zeros(G(0.2),(-10.0,10.0)))[2]
X (generic function with 1 method)
julia> X(0.2)
0.5758872343937891

As for the power of Roots:

Richard Feynman said (Lectures on Physics):

βAll of the laws of physics can be contained in one equation. That equation is U=0 .β

So root finding is pretty powerful (lots of small print here).