#10952: better numerical accuracy testing
-----------------------------------------+----------------------------------
   Reporter:  robertwb                   |          Owner:  mvngu          
       Type:  enhancement                |         Status:  needs_review   
   Priority:  critical                   |      Milestone:  sage-4.7.2     
  Component:  doctest                    |       Keywords:                 
Work_issues:                             |       Upstream:  N/A            
   Reviewer:  Jason Grout, Mariah Lenox  |         Author:  Robert Bradshaw
     Merged:                             |   Dependencies:                 
-----------------------------------------+----------------------------------

Old description:

> If a line contains ``tol`` or ``tolerance, numerical results are only
> verified to the given tolerance. This may be prefixed by ``abs[olute``
> or ``rel[ative]`` to specify whether to measure absolute or relative
> error; defaults to relative error except when the expected value is
> exactly zero:
>
> {{{
>         sage: RDF(pi)                               # abs tol 1e-5
>         3.14159
>         sage: [10^n for n in [0.0 .. 4]]            # rel tol 2e-4
>         [0.9999, 10.001, 100.01, 999.9, 10001]
> }}}
>
> This can be useful when the exact output is subject to rounding error
> and/or processor floating point arithmetic variation.
>
> '''Apply''':
>   1.  [attachment:10952-tol-bin.patch]
>   1.  [attachment:10952-tol-doc.2.patch]
>   1.  [attachment:trac_10952-reviewer-docs.patch]

New description:

 If a line contains ``tol`` or ``tolerance, numerical results are only
 verified to the given tolerance. This may be prefixed by ``abs[olute``
 or ``rel[ative]`` to specify whether to measure absolute or relative
 error; defaults to relative error except when the expected value is
 exactly zero:

 {{{
         sage: RDF(pi)                               # abs tol 1e-5
         3.14159
         sage: [10^n for n in [0.0 .. 4]]            # rel tol 2e-4
         [0.9999, 10.001, 100.01, 999.9, 10001]
 }}}

 This can be useful when the exact output is subject to rounding error
 and/or processor floating point arithmetic variation.

 '''Apply''':
   1.  [attachment:10952-tol-bin.patch] - to the local/bin repo
   1.  [attachment:10952-tol-doc.2.patch] - to the devel/sage repo
   1.  [attachment:trac_10952-reviewer-docs.patch] - to the devel/sage repo

--

Comment(by was):

 This ticket is pretty amazing.

 Rob, this doctest you added seems very wrong:
 {{{

    A relative tolerance on a root of a polynomial.

    ::

        sage: p = (y - 10^16)*(y-10^(-13))*(y-2); p
        y^3 + (-1e+16)*y^2 + (2e+16)*y - 2000.0
        sage: p.roots()
        sage: p.roots(multiplicities=False)[2]     # relative tol 1e-10
        10^16
 }}}

 In particular,

    * it seems that y isn't defined
    * the output of {{{p.roots()}}} is missing
    * I get an output of {{{1e16}}} instead of {{{10^16}}}.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10952#comment:22>
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