I think there is a conceptual problem with function returning <float>s.

Consider the following:

def find_roots( func,l,r ):
    tol = 1e-10
    try:
        result = find_root( func,l,r ) )
    except RuntimeError:
        return []
    return find_roots( func,l,result-tol )+[ result ]+find_roots( 
func,result+tol,r )

Ignoring, for the moment, that find_root returns a <float>, too (and
therefore is a problem by itsself).

If "func" is a function which does not automatically evaluate to a
number (where only evalf_func evaluates), we need to write

[...] find_root( lambda x: func.n( x ),l,r )

instead, because otherwise find_root crashes. But then, this doesn't
work if func returns a <float>, because float has no .n( ).

So what's the solution to this dilemma? I think this is only permanently
solved by making sure functions generally return a Sage-type

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to