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

sage.plot: Update # needs, doctest cosmetics; fix sig_on_count doctest dataflow warnings #36950

Merged
merged 15 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/sage/categories/finite_complex_reflection_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,22 +555,22 @@ def milnor_fiber_poset(self):
sage: sum(x**P.rank(elt) for elt in P)
18*x^2 + 15*x + 1

sage: W = ReflectionGroup(4) # optional - gap3
sage: P = W.milnor_fiber_poset() # optional - gap3
sage: P # optional - gap3
sage: # optional - gap3
sage: W = ReflectionGroup(4)
sage: P = W.milnor_fiber_poset(); P
Finite meet-semilattice containing 41 elements
sage: sum(x**P.rank(elt) for elt in P) # optional - gap3
sage: sum(x**P.rank(elt) for elt in P)
24*x^2 + 16*x + 1

sage: W = ReflectionGroup([4,2,2]) # optional - gap3
sage: W.is_well_generated() # optional - gap3
sage: # optional - gap3
sage: W = ReflectionGroup([4,2,2])
sage: W.is_well_generated()
False
sage: P = W.milnor_fiber_poset() # optional - gap3
sage: P # optional - gap3
sage: P = W.milnor_fiber_poset(); P
Finite poset containing 47 elements
sage: sum(x**P.rank(elt) for elt in P) # optional - gap3
sage: sum(x**P.rank(elt) for elt in P)
16*x^3 + 24*x^2 + 6*x + 1
sage: P.is_meet_semilattice() # optional - gap3
sage: P.is_meet_semilattice()
False
"""
I = self.index_set()
Expand Down
19 changes: 10 additions & 9 deletions src/sage/coding/ag_code_decoders.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,18 @@ EXAMPLES::
The ``decoder`` is now ready for correcting vectors received from a noisy
channel::

sage: channel = channels.StaticErrorRateChannel(code.ambient_space(), tau) # long time
sage: message_space = decoder.message_space() # long time
sage: message = message_space.random_element() # long time
sage: encoder = decoder.connected_encoder() # long time
sage: sent_codeword = encoder.encode(message) # long time
sage: received_vector = channel(sent_codeword) # long time
sage: (received_vector - sent_codeword).hamming_weight() # long time
sage: # long time
sage: channel = channels.StaticErrorRateChannel(code.ambient_space(), tau)
sage: message_space = decoder.message_space()
sage: message = message_space.random_element()
sage: encoder = decoder.connected_encoder()
sage: sent_codeword = encoder.encode(message)
sage: received_vector = channel(sent_codeword)
sage: (received_vector - sent_codeword).hamming_weight()
4
sage: decoder.decode_to_code(received_vector) == sent_codeword # long time
sage: decoder.decode_to_code(received_vector) == sent_codeword
True
sage: decoder.decode_to_message(received_vector) == message # long time
sage: decoder.decode_to_message(received_vector) == message
True

AUTHORS:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/doctest/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def _process_doc(self, doctests, doc, namespace, start):
# Line number refers to the end of the docstring
sigon = doctest.Example(sig_on_count_doc_doctest, "0\n", lineno=docstring.count("\n"))
sigon.sage_source = sig_on_count_doc_doctest
sigon.optional_tags = frozenset()
sigon.optional_tags = frozenset(self.file_optional_tags)
sigon.probed_tags = frozenset()
dt.examples.append(sigon)
doctests.append(dt)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/ntl/ntl_ZZ_pEX_linkage.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ cdef inline int celement_pow(ZZ_pEX_c* res, ZZ_pEX_c* x, long e, ZZ_pEX_c *modul
sage: (x+1)^(-2)
1/(x^2 + 2*x + 1)
sage: f = x+(a+1)
sage: f**50 == sum(binomial(50,i)*(a+1)**i*x**(50-i) for i in range(51))
sage: f**50 == sum(binomial(50,i)*(a+1)**i*x**(50-i) for i in range(51)) # needs sage.symbolic
True

TESTS:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/misc/converting_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
This is used e.g. in the result of a variety, to allow access to the
result no matter how a generator is identified::

sage: # needs sage.rings.number_field
sage: # needs sage.libs.singular sage.rings.number_field
sage: K.<x,y> = QQ[]
sage: I = ideal([x^2 + 2*y - 5, x + y + 3])
sage: V = sorted(I.variety(AA), key=str)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/misc/replace_dot_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def process_line(location, line, replacements, row_index, verbose=False):
sage: from sage.misc.replace_dot_all import *
sage: location = os.path.join(sage.env.SAGE_SRC, 'sage/plot/arc.py')
sage: replacements = find_replacements(location, package_regex='sage[.]plot[.]all', verbose=True); replacements
[[476, 24, 'from sage.plot.graphics import Graphics']]
[[477, 24, 'from sage.plot.graphics import Graphics']]
sage: with open(location, "r") as file:
....: lines = file.readlines()
sage: row_index, col_number, *_ = replacements[0]
Expand Down
2 changes: 1 addition & 1 deletion src/sage/misc/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def __eq__(self, other):

EXAMPLES::

sage: # needs sage.modules sage.plot
sage: # needs sage.modules sage.plot sage.symbolic
sage: rows = [['a', 'b', 'c'], [1,plot(sin(x)),3], [4,5,identity_matrix(2)]]
sage: T = table(rows, header_row=True)
sage: T2 = table(rows, header_row=True)
Expand Down
3 changes: 2 additions & 1 deletion src/sage/plot/animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ def make_image(self, frame, filename, **kwds):
....: floor(G.ymin()), ceil(G.ymax()))
....: G.save_image(filename, **kwds)

sage: B = MyAnimation([graphs.CompleteGraph(n) for n in range(7,11)], figsize=5)
sage: B = MyAnimation([graphs.CompleteGraph(n)
....: for n in range(7,11)], figsize=5)
sage: d = B.png()
sage: v = os.listdir(d); v.sort(); v
['00000000.png', '00000001.png', '00000002.png', '00000003.png']
Expand Down
1 change: 1 addition & 0 deletions src/sage/plot/arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self, x, y, r1, r2, angle, s1, s2, options):

EXAMPLES::

sage: # needs sage.symbolic
sage: A = arc((2,3),1,1,pi/4,(0,pi))
sage: A[0].x == 2
True
Expand Down
5 changes: 3 additions & 2 deletions src/sage/plot/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def mod_one(x):
0.0
sage: mod_one(-11/7)
0.4285714285714286
sage: mod_one(pi) + mod_one(-pi)
sage: mod_one(pi) + mod_one(-pi) # needs sage.symbolic
1.0
"""
x = float(x)
Expand Down Expand Up @@ -1146,9 +1146,10 @@ def hue(h, s=1, v=1):
This function makes it easy to sample a broad range of colors for
graphics::

sage: # needs sage.symbolic
sage: p = Graphics()
sage: for phi in xsrange(0, 2 * pi, 1 / pi):
....: p += plot(sin(x + phi), (x, -7, 7), rgbcolor = hue(phi))
....: p += plot(sin(x + phi), (x, -7, 7), rgbcolor=hue(phi))
sage: p
Graphics object consisting of 20 graphics primitives

Expand Down
2 changes: 1 addition & 1 deletion src/sage/plot/ellipse.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def plot3d(self):
TESTS::

sage: from sage.plot.ellipse import Ellipse
sage: Ellipse(0,0,2,1,pi/4,{}).plot3d()
sage: Ellipse(0,0,2,1,pi/4,{}).plot3d() # needs sage.symbolic
Traceback (most recent call last):
...
NotImplementedError
Expand Down
8 changes: 5 additions & 3 deletions src/sage/plot/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def is_Graphics(x):
sage: from sage.plot.graphics import is_Graphics
sage: is_Graphics(1)
False
sage: is_Graphics(disk((0.0, 0.0), 1, (0, pi/2)))
sage: is_Graphics(disk((0.0, 0.0), 1, (0, pi/2))) # needs sage.symbolic
True
"""
return isinstance(x, Graphics)
Expand Down Expand Up @@ -1359,6 +1359,7 @@ def _set_scale(self, subplot, scale=None, base=None):

EXAMPLES::

sage: # needs sage.symbolic
sage: p = plot(x, 1, 10)
sage: fig = p.matplotlib()
sage: ax = fig.get_axes()[0]
Expand All @@ -1373,6 +1374,7 @@ def _set_scale(self, subplot, scale=None, base=None):

TESTS::

sage: # needs sage.symbolic
sage: p._set_scale(ax, 'log')
Traceback (most recent call last):
...
Expand Down Expand Up @@ -1797,7 +1799,7 @@ def show(self, **kwds):

::

sage: G.show(scale='semilogy', base=(3,2)) # base ignored for x-axis # needs sage.symbolic
sage: G.show(scale='semilogy', base=(3,2)) # base ignored for x-axis # needs sage.symbolic

The scale can be also given as a 2-tuple or a 3-tuple.::

Expand All @@ -1816,7 +1818,7 @@ def show(self, **kwds):
some examples.::

sage: G = list_plot([10**i for i in range(10)]) # long time, needs sage.symbolic
sage: G.show(scale='semilogy') # long time
sage: G.show(scale='semilogy') # long time, needs sage.symbolic

::

Expand Down
4 changes: 2 additions & 2 deletions src/sage/plot/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ def histogram(datalist, **options):

sage: nv = normalvariate
sage: H = histogram([nv(0, 1) for _ in range(1000)], bins=20, density=True, range=[-5, 5])
sage: P = plot(1/sqrt(2*pi)*e^(-x^2/2), (x, -5, 5), color='red', linestyle='--')
sage: H+P
sage: P = plot(1/sqrt(2*pi)*e^(-x^2/2), (x, -5, 5), color='red', linestyle='--') # needs sage.symbolic
sage: H + P # needs sage.symbolic
Graphics object consisting of 2 graphics primitives

.. PLOT::
Expand Down
2 changes: 2 additions & 0 deletions src/sage/plot/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ def line2d(points, **options):

A purple plot of the Riemann zeta function `\zeta(1/2 + it)`, `0 < t < 30`::

sage: # needs sage.libs.pari sage.rings.complex_double
sage: i = CDF.gen()
sage: v = [zeta(0.5 + n/10 * i) for n in range(300)]
sage: L = [(z.real(), z.imag()) for z in v]
Expand Down Expand Up @@ -590,6 +591,7 @@ def line2d(points, **options):

A red, blue, and green "cool cat"::

sage: # needs sage.symbolic
sage: G = plot(-cos(x), -2, 2, thickness=5, rgbcolor=(0.5,1,0.5))
sage: P = polygon([[1,2], [5,6], [5,0]], rgbcolor=(1,0,0))
sage: Q = polygon([(-x,y) for x,y in P[0]], rgbcolor=(0,0,1))
Expand Down
2 changes: 1 addition & 1 deletion src/sage/plot/matrix_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def matrix_plot(mat, xrange=None, yrange=None, **options):

::

sage: matrix_plot([[sin(x), cos(x)], [1, 0]])
sage: matrix_plot([[sin(x), cos(x)], [1, 0]]) # needs sage.symbolic
Traceback (most recent call last):
...
TypeError: mat must be a Matrix or a two dimensional array
Expand Down
Loading