This happened in https://trac.sagemath.org/ticket/29662, as requested
by kcrisman.  I just looked at that
ticket and added a comment about several additional examples where
deprecating mean breaks things
in subtle ways...

On Sat, Feb 12, 2022 at 7:14 PM Samuel Lelievre
<samuel.lelie...@gmail.com> wrote:
>
> Dear sage-devel,
>
> Taking averages is a common operation, and a `mean` function
> such that `mean(xx)` returns `sum(xx) / len(xx)` regardless of
> the type of objects in the iterable `xx` is extremely convenient.
>
> For instance, for a polygon whose vertices `uu` have coordinates
> in a number field and are represented as vectors over that field,
> `mean(uu)` finds the centre of that polygon. To center the polygon
> at the origin, use `c = mean(uu)` and `vv = [u - c for u in uu]`.
>
> In Sage 9.5, using `mean` displays a warning:
> ```
> DeprecationWarning: sage.stats.basic_stats.mean is deprecated;
> use numpy.mean or numpy.nanmean instead
> ```
> This is after #29662 was merged in SageMath 9.5.beta1.
>
> Alas, `numpy.mean` cannot find the mean of a list of vectors
> over a number field.
>
> Of course, as a workaround, I can define
>
> def mean(xx):
>     r"""
>     Return the mean of this iterable.
>     """
>     return sum(xx) / len(xx)
>
> and place that in an `init.sage` file in my `~/.sage` folder.
>
> Having that built into Sage is so much more convenient though.
> Can we have it back?
>
> Kind polygonal regards,  --Samuel
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/60fe4b1c-db88-4caa-8d13-670b9b3edb79n%40googlegroups.com.



-- 
William (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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CACLE5GDvWCNCL2mFh0qje6gpeUNZKt6hnn3AQvguvFY7SxdEgQ%40mail.gmail.com.

Reply via email to