@C_R As you've seen, one aspect of your original approach is that **f(x__0)** gets evaluated with **x__0** being a mere name. In this case you encountered problems with that.

That aspect is sometimes called "premature evaluation", with a problem ensuing because procedure **f** is not handling a mere name as you'd prefer. The aspect is that procedure **f** is being called before its argument gets an actual numeric value.

__Previously__ you were given some ways in which the root-finding could be accomplished (using Maple 2021 at the time).

Your procedure f was defined as,

**f := x__0 -> int(1/sqrt(sin(x__0) - sin(x)), x = 0 .. x__0)**

Note that for,

**fsolve(f(x__0) = 2*sqrt(alpha), x__0 = 0 .. 0.9*Pi/2)**

the call **f(x__0)** for **x__0** a mere name occurs before **fsolve** ever receives any arguments. The call **f(x__0)** is being evaluated prematurely.

In my Maple 2023.0 the approach of delaying the evaluation of **f(x__0)** does succeed, ie,

**g := alpha -> fsolve('f(x__0) = 2*sqrt(alpha)', x__0 = 0 .. Pi*1/2*0.9):**

g(0.6336176953);

produces the answer 0.5614162053. It is slow, taking about 75 seconds, because the numeric integrations are not fast.

For me, it doesn't take "forever". But it's slow. It's slow because the way in which the numeric integrations are requested makes them slow (not because **fsolve** itself is slow).

You had used a so-called operator calling sequence in a call to **plot**. That's another way to avoid the call **f(x__0)** for **x__0** a name. A similar approach for **fsolve** can also avoid the premature evaluation. This too takes about 75 seconds for me.

**g := alpha -> fsolve(f - 2*sqrt(alpha), 0 .. Pi*1/2*0.9):**

g(0.6336176953);

At the risk of being irritating, I'll mention that (as shown before), with a bit of care using numeric integration can do well here. Here's a slightly different tweak that I showed before (which was a coarser error tolerance with a slightly higher working precision).

**f := x__0 -> int(1/sqrt(sin(x__0) - sin(x)), x = 0 .. x__0, method = _d01ajc):**

g := alpha -> fsolve(f - 2*sqrt(alpha), 0 .. Pi*1/2*0.9):

g(0.6336176953);

That produces the answer 0.5614162054 in less that one second, for me.

As Preben has shown, the integral can be solved symbolically under assumptions and a procedure formed from the result using **unapply**. __Previously__ I too had shown a symbolic integration under assumptions, using Maple 2021 and a change of variables, followed by **unapply**. The ensuing **fsolve** attempt is *very* fast. As you've seen, cases that do not do well here include that in which the integration is attempted symbolically but without the key assumptions.