Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let std work on a list of floats #29232

Closed
slel opened this issue Feb 21, 2020 · 4 comments
Closed

Let std work on a list of floats #29232

slel opened this issue Feb 21, 2020 · 4 comments

Comments

@slel
Copy link
Member

slel commented Feb 21, 2020

Initial report by Ingo Dahn at:

Minimal example:

sage: version()
'SageMath version 9.0, Release Date: 2020-01-01'
sage: sage: std([float(3.2), float(3.4)])
Traceback (most recent call last)
...
AttributeError: 'float' object has no attribute 'sqrt'

Fix this by changing the function std(v, bias) at line 219 of
src/sage/stats/basic_stats.py:

-    return variance(v, bias=bias).sqrt()
+    try:
+        return variance(v, bias=bias).sqrt()
+     except AttributeError:
+        from sage.functions.other import sqrt
+        return sqrt(variance(v, bias=bias))

It turns out this was already fixed at #29184, merged in Sage 9.1.beta5.

CC: @fchapoton @slel

Component: statistics

Keywords: float, std, sqrt

Issue created by migration from https://trac.sagemath.org/ticket/29232

@slel slel added this to the sage-9.1 milestone Feb 21, 2020
@slel

This comment has been minimized.

@fchapoton
Copy link
Contributor

comment:2

what about #29184 ?

@slel
Copy link
Member Author

slel commented Feb 22, 2020

comment:3

Sorry, missed that. Please close as duplicate.

@slel slel removed this from the sage-9.1 milestone Feb 22, 2020
@slel

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants