Hi,
Going with the topic of this thread, a new Sage user just sent me an
email explaining that an example from Ch 8 of Craig Finch's book
doesn't work with sage-5.10.beta4:
var('x')
f = lambda x: 3 * x^3 - 7 * x^2 + 2
minval, x_min = find_minimum_on_interval(f, 0, 3)
print("Min on interval [0,3]: f({0}) = {1}".format(x_min, minval))
maxval, x_max = find_maximum_on_interval(f, -1, 1)
print("Max on interval [-1,1]: f({0}) = {1}".format(x_max, maxval))
f_plot = plot(f,(x, -1, 2.5))
min_point = point((x_min, minval), color='red', size=50)
max_point = point((x_max, maxval), color='black', size=50)
show(f_plot + min_point + max_point, figsize=(4, 4))
I tried it out, and the fix is to change find_minimum_on_interval to
find_local_minimum, and the same with maximum, so this works:
var('x')
f = 3 * x^3 - 7 * x^2 + 2
minval, x_min = find_local_minimum(f, 0, 3)
print("Min on interval [0,3]: f({0}) = {1}".format(x_min, minval))
maxval, x_max = find_local_maximum(f, -1, 1)
print("Max on interval [-1,1]: f({0}) = {1}".format(x_max, maxval))
f_plot = plot(f,(x, -1, 2.5))
min_point = point((x_min, minval), color='red', size=50)
max_point = point((x_max, maxval), color='black', size=50)
show(f_plot + min_point + max_point, figsize=(4, 4))
#########
Anyway this was caused by
http://trac.sagemath.org/2607, which is a
complicated ticket with remarks like "I'm not in favour of giving a
positive review, since the proposed patch does not solve the problem
described in the description of that ticket. -- Paul Zimmerman". I
hope maybe people who were involved will re-consider looking into
this, since it seems that we've broken code in a published Sage book,
which is hard to update (since it is paper).
(In
https://cloud.sagemath.com, this issue a bit non-obvious for users
to resovle because evidently the deprecation decorator is somehow
broken there, at least in this case -- but that's entirely my fault,
and a bug in cloud.sagemath, which I'll fix.)
-- William
> Nicolas M. Thiéry "Isil" <
nth...@users.sf.net>
>
http://Nicolas.Thiery.name/