#9028: Basic Stats - Standard Deviation
--------------------------+-------------------------------------------------
Reporter: amhou | Owner: amhou
Type: defect | Status: needs_work
Priority: minor | Milestone:
Component: statistics | Keywords:
Author: Andrew Hou | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------+-------------------------------------------------
Comment(by benjaminfjones):
I've attached a new patch witch includes the fix plus an example to test
the affected block of code. I couldn't think of a better way to access the
block than to define a toy class that has its own mean() function which
returns a Python long. If the mean() function from basic_stats.py has to
be called, the type of 'x' at line 289 won't ever be 'int' or 'long' so
the code block in question is never reached.
Maybe someone can suggest a better example?
Here is a before / after log to show that the fix works and that the
example tests it.
{{{
sage: R = SillyPythonList()
sage: list(R)
[2L, 4L]
sage: len(R)
2
sage: mean(R)
3L
sage: variance(R)
1
sage: variance(R, bias=True)
1
sage: R = [2,4]
sage: mean(R)
3
sage: variance(R)
2
sage: variance(R,bias=True)
1
### LOG (after patch)
sage: R=SillyPythonList()
sage: len(R)
2
sage: mean(R)
3L
sage: variance(R)
2
sage: variance(R, bias=True)
1
sage: R = [2,4]
sage: variance(R)
2
sage: variance(R, bias=True)
1
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9028#comment:5>
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.