Re: [sage-devel] Re: Dealing with different signs in doctest output?

2012-02-07 Thread Marco Streng

On 07/02/2012 15:43, Jason Grout wrote:

On 2/7/12 9:34 AM, John H Palmieri wrote:

Or as part of the doctest normalize G.round(6): multiply by -1 if the
real part of the (0,0) entry is positive.  If it gets too complicated,
maybe it should be moved to a TESTS block instead of an EXAMPLES block.
I wonder what part of the algorithm leads to a difference choice of sign
on this one platform.


so something like:

sage: G.round(6)*sgn(G[0,0].real())

Thanks,

Jason




These are quite ugly solutions. How do people feel about having a 
solution analogous to #10952?

http://trac.sagemath.org/sage_trac/ticket/10952

For example, let # sign variation ignore every +, -, and space in the 
output string.


Marco




--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Dealing with different signs in doctest output?

2012-02-07 Thread Marco Streng

On 07/02/2012 16:06, Jason Grout wrote:

On 2/7/12 9:55 AM, Marco Streng wrote:

On 07/02/2012 15:43, Jason Grout wrote:

On 2/7/12 9:34 AM, John H Palmieri wrote:
Or as part of the doctest normalize G.round(6): multiply by -1 if 
the

real part of the (0,0) entry is positive. If it gets too complicated,
maybe it should be moved to a TESTS block instead of an EXAMPLES 
block.
I wonder what part of the algorithm leads to a difference choice of 
sign

on this one platform.


so something like:

sage: G.round(6)*sgn(G[0,0].real())

Thanks,

Jason




These are quite ugly solutions. How do people feel about having a
solution analogous to #10952?
http://trac.sagemath.org/sage_trac/ticket/10952

For example, let # sign variation ignore every +, -, and space in the
output string.


But then it would consider the two vectors (-1,2) and (-1,-2) to be 
the same, which is not what we want.


Jason





True, that is the biggest downside of this solution. But examples should 
be illustrative. It would be a shame to have a documentation of a 
function without any printed examples of the output of the function. 
Users may want to see what the output is supposed to look like, as a way 
of understanding what a function does. We can always add another test 
like M*M.transpose() below it if we really are afraid of getting (-1,-2) 
instead of (-1, 2).






--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Dealing with different signs in doctest output?

2012-02-07 Thread Robert Bradshaw
On Tue, Feb 7, 2012 at 8:11 AM, javier vengor...@gmail.com wrote:
 How about testig for the desired mathematical properties? If this is a
 Gram-Schmidt test, the resulting matrix M should be orthogonal, so we
 can test for M*M.transpose() being the identity matrix (up to
 numerical accuracy). Of course, this type of indirect test should
 belong to the test section, not to the examples section.

+1, this is the best way to test it. However, this kind of of indirect
test is exactly the thing that *should* go in the examples section
(whether or not it's needed for testing), as it is a good illustration
of what the expected mathematical properties are. (In fact I consider
tests like this to be much better than here's the answer tests; one
could take the Gram-Schmidt of a random 100x100 matrix and verify it's
nearly orthogonal rather than print out the meaningless coefficients
themselves.)

- Robert

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org