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




On Thu, May 23, 2013 at 6:28 PM, Nicolas M. Thiery
<nicolas.thi...@u-psud.fr> wrote:
> On Thu, May 23, 2013 at 12:57:30PM -0700, Rob Beezer wrote:
>>    I have given this a lot of thought the past few years (perhaps this is
>>    obvious).  I prepared extensive material about Sage for Tom Judson's
>>    Abstract Algebra book and have an automated procedure to produce doctests
>>    of the code examples.  While I use sagetex for some aspects of this, the
>>    philosophy is the reverse.  I provide expected output in the source,
>>    rather than just blindly letting Sage produce the output.  In a few places
>>    I illustrate bugs, in hope of catching their corrections later.
>
> For the record: for the French sage book we are following the same
> strategy, using sagetex. We put the expected results in the file.  and
> sagetex extracts a file on which we can run the tests (and that we can
> submit for inclusion into Sage). Depending on the situation the
> examples are setup so that what's get typeset is either the latex
> output produced by sage, the text output produced by sage, or the
> expected output that is specified in the file.
>
> It's not perfect (especially for speed of compilation). Also in the
> process we patched quite some sagetex and it would be great if those
> patches made their way into standard sagetex (hint hint).
>
> Cheers,
>                                 Nicolas
> --
> Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
> http://Nicolas.Thiery.name/
>
> --
> 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 sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
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 sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
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