Opened 12 years ago

Closed 10 years ago

#5960 closed defect (duplicate)

fix bug in documentation of find_minimum_on_interval

Reported by: was Owned by: burcin
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: calculus Keywords: sd31
Cc: kcrisman Merged in:
Authors: Reviewers: Karl-Dieter Crisman, Burcin Erocal
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


From Thomas Savitsky (on sage-devel):
> > I've noticed that the function find_minimum_on_interval makes no attempt to
> > find "the" minimum on the interval as the documentation implies, but rather
> > "a local" minimum.  I imagine this may be a source of confusion for other
> > new users as well.  Rather than treating this as a bug, may I suggest
> > changing the documentation for this function to reflect that it only finds a
> > local minimum and adding an additional function which searches for a global
> > minimum?
> +1  Can you provide a few examples for the docstring that illustrate this?

Do these work?

sage: h(x) =  -sin(x) - 2*sin(2*x)
sage: h.find_minimum_on_interval(0, 2*pi)
(-1.3271810224585345, 3.8298351449342838)
But there is another local minimum at h(0.8666760871050464) = -2.73581510406

sage: find_minimum_on_interval(x*(x-1)*(x+1), -2, 2)
(-0.38490017945975047, 0.57735026913115706)
The minimum on this interval is the endpoint h(-2) = 6.

sage: find_minimum_on_interval((x-2)*(x-1)*x*(x+1) - x, -2, 2)
(-0.43749999999999994, -0.49999999973911674)

sage: find_minimum_on_interval((x-2)*(x-1)*x*(x+1) - x, 0, 2)
(-2.6642135623730949, 1.7071067879138031)


Change History (7)

comment:1 Changed 12 years ago by burcin

The real problem is described in #2607. I suggest we fix that instead of changing the documentation to justify this behavior.

If people think it necessary, we can create another function called .find_local_minimum() with the current behavior.

Note that I haven't looked at the code at all, and it's possible that I'm missing the point entirely.

comment:2 Changed 10 years ago by kcrisman

  • Cc kcrisman added
  • Report Upstream set to N/A

comment:3 Changed 10 years ago by kcrisman

  • Keywords sd31 added

This Scipy tutorial page should be relevant. I will try to resolve this soon.

comment:4 Changed 10 years ago by kcrisman

  • Reviewers set to Karl-Dieter Crisman, Burcin Erocal
  • Status changed from new to needs_review
sage: from scipy import optimize
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)

From the tutorial referenced above:

Finds a local minimizer 

so I agree this should be closed as a dup.

Moving examples there.

comment:5 Changed 10 years ago by kcrisman

  • Status changed from needs_review to positive_review

To release manager - please close as a duplicate of #2607.

comment:6 Changed 10 years ago by jdemeyer

  • Milestone changed from sage-4.7.1 to sage-duplicate/invalid/wontfix

comment:7 Changed 10 years ago by jdemeyer

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.