Question: In fsolve: Would it make sense to implicitly try to use ranges as assumptions

In the following example, the information in which range fsolve should search for a solution and the range in which a function is defined is somehow redundant. (This example has been adopted from here where fsolve without assumptions does not throw an error but evaluates forever.)

Why can’t fsolve not always assume that the range equals the domain of interest? This would make life easier and provide more solutions to inexperienced users who have not yet learned the need for assumptions.

If there are good reasons (and there probably are) that such an implicit assumption (i.e. range equals domain) would be too restrictive: can’t fsolve give a hint or provide an new option to use ranges as assumptions?

Example with incomplete elliptic integral of the first kind

f := proc (x__0) options operator, arrow; int(1/(sqrt(x__0-x)*sqrt(-x^2+1)), x = 0 .. x__0) end proc

proc (x__0) options operator, arrow; int(1/(sqrt(x__0-x)*sqrt(-x^2+1)), x = 0 .. x__0) end proc

(1)

Range := 0 .. 1; plot(f(x__0), x__0 = Range, labels = [x__0, 'f(x__0)'])

 

f(.5) = 1.524886838NULL

Defining the inverse of f

g := proc (y) options operator, arrow; fsolve(`assuming`([f(x__0) = y, x__0 = Range], [lhs(Range) <= x__0 and x__0 <= rhs(Range)])) end proc

proc (y) options operator, arrow; fsolve(`assuming`([f(x__0) = y, x__0 = Range], [lhs(Range) <= x__0 and x__0 <= rhs(Range)])) end proc

(2)

x__0 = g(f(.5)) → x__0 = .5000000000NULL

Now without assumptions

h := proc (y) options operator, arrow; fsolve(f(x__0) = y, x__0 = Range) end proc

proc (y) options operator, arrow; fsolve(f(x__0) = y, x__0 = Range) end proc

(3)

h(f(.5))

Error, (in fsolve) cannot determine if this expression is true or false: abs(Re(x))+abs(Im(x)) <= 0.

 

``

Download ranges_as_assumptions.mw

Please Wait...