#2607: find_minimum_on_interval() uses the wrong scipy function
--------------------------+-------------------------------------------------
   Reporter:  AlexGhitza  |          Owner:  was       
       Type:  defect      |         Status:  new       
   Priority:  major       |      Milestone:  sage-4.7.1
  Component:  calculus    |       Keywords:  sd31      
Work_issues:              |       Upstream:  N/A       
   Reviewer:              |         Author:            
     Merged:              |   Dependencies:            
--------------------------+-------------------------------------------------

Comment(by kcrisman):

 Answering the question first...

 Sure, but it would be nice if we at least got the 'right' answer for
 'easy' functions.  That's all I'm looking for here, not things like
 finding a minimum on a set of measure zero...

 ----


 I think we can fix Brent to use this.  Compare:
 {{{
 sage: optimize.fminbound(h._fast_float_(x),0,6,full_output=True)
 (3.8298366870225147, -1.327181022449951, 0, 10)
 sage: optimize.fminbound(h._fast_float_(x),0,3,full_output=True)
 (0.86667541098916612, -2.7358151040622416, 0, 9)
 sage: optimize.brent(h._fast_float_(x),brack=(0,6),full_output=True)
 (0.86667608708813437, -2.73581510406422, 11, 12)
 }}}
 This shows that brent does give the 'right' answer in this case.   So when
 does it give a 'wrong' answer?
 {{{
 sage: j(x) = sin(x)
 sage: optimize.brent(j._fast_float_(x),brack=(0,6),full_output=True)
 (10.995574367047061, -0.99999999999999689, 10, 11)
 sage: 3.5*pi.n()
 10.9955742875643
 }}}
 Well, of course - there IS no calculus-style minimum of sin between 0 and
 pi!  Only a minimum relative to the interval itself.  Interesting that it
 goes all the way to 7/2*pi, rather than 3/2*pi, but oh well!

 So the fix is to switch to Brent, and then if it gives an answer outside
 the interval, pick the 'lower' endpoint.  This would need lots of testing
 with well-behaved functions to make sure they actually work correctly.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/2607#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to