Skip to content

Commit d89bb1c

Browse files
author
Release Manager
committed
gh-42070: src/sage/stats: remove remaining "needs sage.foo" tags These are unmaintained, and don't do anything in the upstream SageMath library. URL: #42070 Reported by: Michael Orlitzky Reviewer(s):
2 parents fd9e1b6 + 06b7ed6 commit d89bb1c

8 files changed

Lines changed: 29 additions & 33 deletions

File tree

src/sage/stats/basic_stats.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ def mean(v):
6666
6767
EXAMPLES::
6868
69-
sage: mean([pi, e]) # needs sage.symbolic
69+
sage: mean([pi, e])
7070
doctest:warning...
7171
DeprecationWarning: sage.stats.basic_stats.mean is deprecated;
7272
use numpy.mean or numpy.nanmean instead
7373
See https://github.com/sagemath/sage/issues/29662 for details.
7474
1/2*pi + 1/2*e
75-
sage: mean([]) # needs sage.symbolic
75+
sage: mean([])
7676
NaN
77-
sage: mean([I, sqrt(2), 3/5]) # needs sage.symbolic
77+
sage: mean([I, sqrt(2), 3/5])
7878
1/3*sqrt(2) + 1/3*I + 1/5
7979
sage: mean([RIF(1.0103,1.0103), RIF(2)])
8080
1.5051500000000000?
@@ -192,7 +192,6 @@ def std(v, bias=False):
192192
193193
EXAMPLES::
194194
195-
sage: # needs sage.symbolic
196195
sage: std([1..6], bias=True)
197196
doctest:warning...
198197
DeprecationWarning: sage.stats.basic_stats.std is deprecated;
@@ -287,11 +286,11 @@ def variance(v, bias=False):
287286
7/2
288287
sage: variance([1..6], bias=True)
289288
35/12
290-
sage: variance([e, pi]) # needs sage.symbolic
289+
sage: variance([e, pi])
291290
1/2*(pi - e)^2
292291
sage: variance([])
293292
NaN
294-
sage: variance([I, sqrt(2), 3/5]) # needs sage.symbolic
293+
sage: variance([I, sqrt(2), 3/5])
295294
1/450*(10*sqrt(2) - 5*I - 3)^2 + 1/450*(5*sqrt(2) - 10*I + 3)^2
296295
+ 1/450*(5*sqrt(2) + 5*I - 6)^2
297296
sage: variance([RIF(1.0103, 1.0103), RIF(2)])
@@ -389,11 +388,11 @@ def median(v):
389388
use numpy.median or numpy.nanmedian instead
390389
See https://github.com/sagemath/sage/issues/29662 for details.
391390
3
392-
sage: median([e, pi]) # needs sage.symbolic
391+
sage: median([e, pi])
393392
1/2*pi + 1/2*e
394393
sage: median(['sage', 'linux', 'python'])
395394
'python'
396-
sage: median([]) # needs sage.symbolic
395+
sage: median([])
397396
NaN
398397
sage: class MyClass:
399398
....: def median(self):
@@ -447,7 +446,7 @@ def moving_average(v, n):
447446
[5/2, 7/2, 9/2, 11/2, 13/2, 15/2, 17/2]
448447
sage: moving_average([], 1)
449448
[]
450-
sage: moving_average([pi, e, I, sqrt(2), 3/5], 2) # needs sage.symbolic
449+
sage: moving_average([pi, e, I, sqrt(2), 3/5], 2)
451450
[1/2*pi + 1/2*e, 1/2*e + 1/2*I, 1/2*sqrt(2) + 1/2*I,
452451
1/2*sqrt(2) + 3/10]
453452

src/sage/stats/distributions/discrete_gaussian_integer.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# sage.doctest: needs sage.symbolic
21
#
32
# distutils: sources = sage/stats/distributions/dgs_gauss_mp.c sage/stats/distributions/dgs_gauss_dp.c sage/stats/distributions/dgs_bern.c
43
# distutils: depends = sage/stats/distributions/dgs_gauss.h sage/stats/distributions/dgs_bern.h sage/stats/distributions/dgs_misc.h

src/sage/stats/distributions/discrete_gaussian_lattice.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class DiscreteGaussianDistributionLatticeSampler(SageObject):
142142
sage: D = distributions.DiscreteGaussianDistributionLatticeSampler(identity_matrix(2), 3.0)
143143
sage: S = [D() for _ in range(2^12)]
144144
sage: l = [vector(v.list() + [S.count(v)]) for v in set(S)]
145-
sage: list_plot3d(l, point_list=True, interpolation='nn') # needs sage.plot
145+
sage: list_plot3d(l, point_list=True, interpolation='nn')
146146
Graphics3d Object
147147
148148
REFERENCES:
@@ -447,7 +447,7 @@ def __init__(self, B, sigma=1, c=0, r=None, precision=None, sigma_basis=False):
447447
sage: n = 2; sigma = 3.0
448448
sage: D = distributions.DiscreteGaussianDistributionLatticeSampler(ZZ^n, sigma)
449449
sage: f = D.f
450-
sage: nf = D._normalisation_factor_zz(); nf # needs sage.symbolic
450+
sage: nf = D._normalisation_factor_zz(); nf
451451
56.5486677646...
452452
453453
sage: from collections import defaultdict
@@ -461,15 +461,15 @@ def __init__(self, B, sigma=1, c=0, r=None, precision=None, sigma_basis=False):
461461
sage: v = vector(ZZ, n, (-3, -3))
462462
sage: v.set_immutable()
463463
sage: while v not in counter: add_samples(1000)
464-
sage: while abs(m*f(v)*1.0/nf/counter[v] - 1.0) >= 0.1: # needs sage.symbolic
464+
sage: while abs(m*f(v)*1.0/nf/counter[v] - 1.0) >= 0.1:
465465
....: add_samples(1000)
466466
467467
sage: counter = defaultdict(Integer); m = 0
468468
sage: v = vector(ZZ, n, (0, 0))
469469
sage: v.set_immutable()
470470
sage: while v not in counter:
471471
....: add_samples(1000)
472-
sage: while abs(m*f(v)*1.0/nf/counter[v] - 1.0) >= 0.1: # needs sage.symbolic
472+
sage: while abs(m*f(v)*1.0/nf/counter[v] - 1.0) >= 0.1:
473473
....: add_samples(1000)
474474
475475
Spherical covariance are automatically handled::
@@ -505,7 +505,7 @@ def __init__(self, B, sigma=1, c=0, r=None, precision=None, sigma_basis=False):
505505
....: add_samples(1000)
506506
sage: sum(counter.values()) # random
507507
3000
508-
sage: while abs(m*f(v)*1.0/nf/counter[v] - 1.0) >= 0.1: # long time, needs sage.symbolic
508+
sage: while abs(m*f(v)*1.0/nf/counter[v] - 1.0) >= 0.1: # long time
509509
....: add_samples(1000)
510510
511511
If the covariance provided is not positive definite, an error is thrown::

src/sage/stats/distributions/discrete_gaussian_polynomial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
sage: sigma = 3.0; n = 1000
1717
sage: l = [DiscreteGaussianDistributionPolynomialSampler(ZZ['x'], 64, sigma)()
1818
....: for _ in range(n)]
19-
sage: l = [vector(f).norm().n() for f in l] # needs sage.symbolic
19+
sage: l = [vector(f).norm().n() for f in l]
2020
sage: from numpy import mean # needs numpy
21-
sage: mean(l), sqrt(64)*sigma # abs tol 5e-1 # needs numpy sage.symbolic
21+
sage: mean(l), sqrt(64)*sigma # abs tol 5e-1 # needs numpy
2222
(24.0, 24.0)
2323
"""
2424
# ******************************************************************************

src/sage/stats/hmm/distributions.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ cdef class Distribution:
127127
EXAMPLES::
128128
129129
sage: P = hmm.GaussianMixtureDistribution([(.2,-10,.5),(.6,1,1),(.2,20,.5)])
130-
sage: P.plot(-10,30) # needs sage.plot
130+
sage: P.plot(-10,30)
131131
Graphics object consisting of 1 graphics primitive
132132
"""
133133
from sage.plot.plot import plot

src/sage/stats/hmm/hmm.pyx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# sage.doctest: needs numpy sage.modules
21
r"""
32
Hidden Markov Models
43
@@ -148,11 +147,11 @@ cdef class HiddenMarkovModel:
148147
sage: m = hmm.DiscreteHiddenMarkovModel([[.3,0,.7],[0,0,1],[.5,.5,0]],
149148
....: [[.5,.5,.2]]*3,
150149
....: [1/3]*3)
151-
sage: G = m.graph(); G # needs sage.graphs
150+
sage: G = m.graph(); G
152151
Looped digraph on 3 vertices
153-
sage: G.edges(sort=True) # needs sage.graphs
152+
sage: G.edges(sort=True)
154153
[(0, 0, 0.3), (0, 2, 0.7), (1, 2, 1.0), (2, 0, 0.5), (2, 1, 0.5)]
155-
sage: G.plot() # needs sage.graphs sage.plot
154+
sage: G.plot()
156155
Graphics object consisting of 11 graphics primitives
157156
"""
158157
cdef int i, j
@@ -313,7 +312,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel):
313312
Initial probabilities: [0.0000, 1.0000]
314313
sage: m.sample(10)
315314
[0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
316-
sage: m.graph().plot() # needs sage.plot
315+
sage: m.graph().plot()
317316
Graphics object consisting of 6 graphics primitives
318317
319318
A 3-state model that happens to always outputs 'b'::

src/sage/stats/intlist.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,9 @@ cdef class IntList:
516516
517517
EXAMPLES::
518518
519-
sage: stats.IntList([3,7,19,-2]).plot() # needs sage.plot
519+
sage: stats.IntList([3,7,19,-2]).plot()
520520
Graphics object consisting of 1 graphics primitive
521-
sage: stats.IntList([3,7,19,-2]).plot(color='red', # needs sage.plot
521+
sage: stats.IntList([3,7,19,-2]).plot(color='red',
522522
....: pointsize=50, points=True)
523523
Graphics object consisting of 1 graphics primitive
524524
"""
@@ -534,7 +534,7 @@ cdef class IntList:
534534
535535
EXAMPLES::
536536
537-
sage: stats.IntList([1..15]).plot_histogram() # needs sage.plot
537+
sage: stats.IntList([1..15]).plot_histogram()
538538
Graphics object consisting of 50 graphics primitives
539539
"""
540540
return self.time_series().plot_histogram(*args, **kwds)

src/sage/stats/time_series.pyx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ cdef class TimeSeries:
9797
9898
This implicitly calls init::
9999
100-
sage: stats.TimeSeries([pi, 3, 18.2]) # needs sage.symbolic
100+
sage: stats.TimeSeries([pi, 3, 18.2])
101101
[3.1416, 3.0000, 18.2000]
102102
103103
Conversion from a NumPy 1-D array, which is very fast::
@@ -1003,7 +1003,7 @@ cdef class TimeSeries:
10031003
10041004
Draw a plot of a time series::
10051005
1006-
sage: stats.TimeSeries([1..10]).show() # needs sage.plot
1006+
sage: stats.TimeSeries([1..10]).show()
10071007
Graphics object consisting of 1 graphics primitive
10081008
"""
10091009
return self.plot(*args, **kwds)
@@ -1029,7 +1029,6 @@ cdef class TimeSeries:
10291029
10301030
EXAMPLES::
10311031
1032-
sage: # needs sage.plot
10331032
sage: v = stats.TimeSeries([5,4,1.3,2,8,10,3,-5]); v
10341033
[5.0000, 4.0000, 1.3000, 2.0000, 8.0000, 10.0000, 3.0000, -5.0000]
10351034
sage: v.plot()
@@ -1903,12 +1902,12 @@ cdef class TimeSeries:
19031902
EXAMPLES::
19041903
19051904
sage: v = stats.TimeSeries([1..50])
1906-
sage: v.plot_histogram(bins=10) # needs sage.plot
1905+
sage: v.plot_histogram(bins=10)
19071906
Graphics object consisting of 10 graphics primitives
19081907
19091908
::
19101909
1911-
sage: v.plot_histogram(bins=3,normalize=False,aspect_ratio=1) # needs sage.plot
1910+
sage: v.plot_histogram(bins=3,normalize=False,aspect_ratio=1)
19121911
Graphics object consisting of 3 graphics primitives
19131912
"""
19141913
from sage.plot.polygon import polygon
@@ -1945,7 +1944,7 @@ cdef class TimeSeries:
19451944
Here we look at the candlestick plot for Brownian motion::
19461945
19471946
sage: v = stats.TimeSeries(1000).randomize()
1948-
sage: v.plot_candlestick(bins=20) # needs sage.plot
1947+
sage: v.plot_candlestick(bins=20)
19491948
Graphics object consisting of 40 graphics primitives
19501949
"""
19511950
from sage.plot.line import line
@@ -2308,7 +2307,7 @@ cdef class TimeSeries:
23082307
sage: v = stats.TimeSeries(10^6)
23092308
sage: v.randomize('lognormal').mean()
23102309
1.647351973...
2311-
sage: exp(0.5) # needs sage.symbolic
2310+
sage: exp(0.5)
23122311
1.648721270...
23132312
23142313
A log-normal distribution can be simply thought of as the logarithm

0 commit comments

Comments
 (0)