Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
a bunch of tiny details in the doc (missing ... and empty lines)
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Feb 23, 2020
1 parent 268f41a commit 002b58a
Show file tree
Hide file tree
Showing 38 changed files with 99 additions and 80 deletions.
1 change: 1 addition & 0 deletions src/sage/algebras/lie_algebras/poincare_birkhoff_witt.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def _coerce_map_from_(self, R):
True
sage: L(prod(pbw.gens()))
Traceback (most recent call last):
...
ValueError: PBW['X']*PBW['Y']*PBW['Z'] is not in the image
sage: L(pbw.one())
Traceback (most recent call last):
Expand Down
3 changes: 2 additions & 1 deletion src/sage/categories/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ def __classcontains__(cls, x):

def is_abelian(self):
"""
Returns whether this category is abelian.
Return whether this category is abelian.
An abelian category is a category satisfying:
Expand Down Expand Up @@ -783,6 +783,7 @@ def is_abelian(self):
True
sage: Semigroups().is_abelian()
Traceback (most recent call last):
...
NotImplementedError: is_abelian
"""
raise NotImplementedError("is_abelian")
Expand Down
4 changes: 2 additions & 2 deletions src/sage/categories/examples/infinite_enumerated_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ def __call__(self, elt):
Integer Ring
sage: NN(-1)
Traceback (most recent call last):
...
ValueError: Value -1 is not a non negative integer.
"""
if elt in self:
return self._element_constructor_(elt)
else:
raise ValueError("Value %s is not a non negative integer."%(elt))
raise ValueError("Value %s is not a non negative integer." % (elt))

def an_element(self):
"""
Expand Down
3 changes: 0 additions & 3 deletions src/sage/coding/linear_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,6 @@ def dimension(self):
....: def generator_matrix(self):
....: G = identity_matrix(GF(5), 5).augment(matrix(GF(5), 5, 7))
....: return G
....:
sage: MonkeyCode._registered_encoders["Monkey"] = MonkeyEncoder
sage: C = MonkeyCode()
sage: C.dimension()
Expand Down Expand Up @@ -3340,7 +3339,6 @@ class LinearCodeSystematicEncoder(Encoder):
....:
....: def _repr_(self):
....: return "Dual of the [%d, 1] Repetition Code over GF(%s)" % (self.length(), self.base_field().cardinality())
....:
sage: DualRepetitionCode(GF(3), 5).generator_matrix()
[1 0 0 0 2]
[0 1 0 0 2]
Expand All @@ -3357,7 +3355,6 @@ class LinearCodeSystematicEncoder(Encoder):
....:
....: def _repr_(self):
....: return "I am a badly defined code"
....:
sage: BadCodeFamily(GF(3), 5).generator_matrix()
Traceback (most recent call last):
...
Expand Down
2 changes: 1 addition & 1 deletion src/sage/combinat/abstract_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ def __setitem__(self, idx, value):
sage: with x.clone() as x:
....: x[0] = OrderedTree([[]])
Traceback (most recent call last):
....:
...
IndexError: list assignment index out of range
sage: x = OrderedTree([]); x = OrderedTree([x,x]); x = OrderedTree([x,x]); x = OrderedTree([x,x])
Expand Down
1 change: 0 additions & 1 deletion src/sage/combinat/backtrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ def __iter__(self):
sage: from sage.combinat.backtrack import SearchForest
sage: def children(l):
....: return [l+[0], l+[1]]
....:
sage: C = SearchForest(([],), children)
sage: f = C.__iter__()
sage: next(f)
Expand Down
4 changes: 1 addition & 3 deletions src/sage/combinat/combinatorial_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def combinatorial_map_wrapper(f=None, order=None, name=None):
sage: def major_index(p):
....: return p.major_index()
....:
sage: major_index
<function major_index at ...>
sage: combinatorial_map(major_index)
Expand Down Expand Up @@ -219,15 +218,14 @@ class CombinatorialMap(object):
"""
def __init__(self, f, order=None, name=None):
"""
Constructor for combinatorial maps
Constructor for combinatorial maps.
EXAMPLES::
sage: from sage.combinat.combinatorial_map import combinatorial_map_wrapper as combinatorial_map
sage: def f(x):
....: "doc of f"
....: return x
....:
sage: x = combinatorial_map(f); x
Combinatorial map: f
sage: x.__doc__
Expand Down
1 change: 0 additions & 1 deletion src/sage/crypto/mq/rijndael_gf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,6 @@ def __init__(self, polynomial_constr, rgf, round_component_name=None):
sage: def my_poly_constr(row, col, algorithm='encrypt'):
....: return x * rgf._F.one() # example body with no checks
....:
sage: rcpc = RijndaelGF.Round_Component_Poly_Constr(
....: my_poly_constr, rgf, "My Poly Constr")
sage: rcpc(-1, 2)
Expand Down
1 change: 1 addition & 0 deletions src/sage/geometry/lattice_polytope.py
Original file line number Diff line number Diff line change
Expand Up @@ -4987,6 +4987,7 @@ def _palp(command, polytopes, reduce_dimension=False):
sage: p = LatticePolytope([(1,0,0), (0,1,0), (-1,0,0), (0,-1,0)])
sage: lattice_polytope._palp("poly.x -f", [p])
Traceback (most recent call last):
...
ValueError: Cannot run PALP for a 2-dimensional polytope in a 3-dimensional space!
sage: result_name = lattice_polytope._palp("poly.x -f", [p], reduce_dimension=True)
Expand Down
8 changes: 6 additions & 2 deletions src/sage/geometry/triangulation/point_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,9 @@ def contained_simplex(self, large=True, initial_point=None, point_order=None):
(P(-1, -1), P(1, 1), P(0, 1))
sage: pc.contained_simplex(point_order = [pc[1],pc[3],pc[4],pc[2],pc[0]])
(P(0, 1), P(1, 1), P(-1, -1))
sage: # lower-dimensional example:
Lower-dimensional example::
sage: pc.contained_simplex(point_order = [pc[0],pc[3],pc[4]])
(P(0, 0), P(1, 1))
Expand Down Expand Up @@ -1969,7 +1971,9 @@ def placing_triangulation(self, point_order=None):
(<1,2,3>, <1,2,4>)
sage: p0.pushing_triangulation(point_order=[0,1,2,3,4])
(<0,1,3>, <0,1,4>, <0,2,3>, <0,2,4>)
sage: # the same triangulation with renumbered points 0->4, 1->0, etc.:
The same triangulation with renumbered points 0->4, 1->0, etc::
sage: p1 = PointConfiguration([(+1,0),(-1,0),(0,+1),(0,-1),(0,0)])
sage: p1.pushing_triangulation(point_order=[4,0,1,2,3])
(<0,2,4>, <0,3,4>, <1,2,4>, <1,3,4>)
Expand Down
12 changes: 9 additions & 3 deletions src/sage/manifolds/continuous_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,9 @@ def _call_(self, point):
sage: M = Manifold(2, 'R^2', latex_name=r'\RR^2', structure='topological') # Euclidean plane
sage: c_cart.<x,y> = M.chart() # Cartesian coordinates
sage: # A pi/3 rotation around the origin defined in Cartesian coordinates:
A pi/3 rotation around the origin defined in Cartesian coordinates::
sage: rot = M.continuous_map(M, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
....: name='R')
sage: p = M.point((1,2), name='p')
Expand Down Expand Up @@ -1450,7 +1452,9 @@ def set_expr(self, chart1, chart2, coord_functions):
sage: U = M.open_subset('U', coord_def={c_xy: (y!=0, x<0)}) # the complement of the segment y=0 and x>0
sage: c_cart = c_xy.restrict(U) # Cartesian coordinates on U
sage: c_spher.<r,ph> = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi') # spherical coordinates on U
sage: # Links between spherical coordinates and Cartesian ones:
Links between spherical coordinates and Cartesian ones::
sage: ch_cart_spher = c_cart.transition_map(c_spher,
....: [sqrt(x*x+y*y), atan2(y,x)])
sage: ch_cart_spher.set_inverse(r*cos(ph), r*sin(ph))
Expand Down Expand Up @@ -1872,7 +1876,9 @@ def __invert__(self):
sage: M = Manifold(2, 'R^2', latex_name=r'\RR^2', structure='topological')
sage: c_cart.<x,y> = M.chart()
sage: # A pi/3 rotation around the origin:
A pi/3 rotation around the origin::
sage: rot = M.homeomorphism(M, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
....: name='R')
sage: rot.inverse()
Expand Down
23 changes: 8 additions & 15 deletions src/sage/manifolds/differentiable/affine_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- [ONe1983]_
"""
#******************************************************************************
# *****************************************************************************
# Copyright (C) 2015 Eric Gourgoulhon <eric.gourgoulhon@obspm.fr>
# Copyright (C) 2015 Michal Bejger <bejger@camk.edu.pl>
# Copyright (C) 2015 Marco Mancini <marco.mancini@obspm.fr>
Expand All @@ -27,7 +27,7 @@
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
#******************************************************************************
# *****************************************************************************

from sage.rings.integer import Integer
from sage.structure.sage_object import SageObject
Expand Down Expand Up @@ -250,7 +250,6 @@ class AffineConnection(SageObject):
....: for j in M.irange():
....: for k in M.irange():
....: nab.add_coef(eV)[i,j,k] = nab.coef(eVW)[i,j,k,c_uvW].expr()
....:
At this stage, the connection is fully defined on all the manifold::
Expand Down Expand Up @@ -301,7 +300,6 @@ class AffineConnection(SageObject):
....: for j in M.irange():
....: for k in M.irange():
....: nab.add_coef(eV)[i,j,k] = nab.coef(eVW)[i,j,k,c_uvW].expr()
....:
At this stage, the connection is fully defined on all the manifold::
Expand Down Expand Up @@ -1635,7 +1633,6 @@ def torsion(self):
....: for j in M.irange():
....: for k in M.irange():
....: nab.add_coef(eV)[i,j,k] = nab.coef(eVW)[i,j,k,c_uvW].expr()
....:
sage: t = nab.torsion() ; t
Tensor field of type (1,2) on the 2-dimensional differentiable
manifold M
Expand Down Expand Up @@ -1759,7 +1756,6 @@ def riemann(self):
....: for j in M.irange():
....: for k in M.irange():
....: nab.add_coef(eV)[i,j,k] = nab.coef(eVW)[i,j,k,c_uvW].expr()
....:
sage: r = nab.riemann() ; r
Tensor field of type (1,3) on the 2-dimensional differentiable
manifold M
Expand Down Expand Up @@ -1790,7 +1786,6 @@ def riemann(self):
....: for j in M.irange():
....: for k in M.irange():
....: nab.add_coef(eV)[i,j,k] = nab.coef(eVW)[i,j,k,c_uvW].expr()
....:
sage: r = nab.riemann() ; r
Tensor field of type (1,3) on the 2-dimensional differentiable
manifold M
Expand Down Expand Up @@ -1991,28 +1986,29 @@ def connection_form(self, i, j, frame=None):
sage: nab.connection_form(1,1,e).comp(e)[:]
[x*y^2*z, (x^2*y + 1)*z/y, -x*y*z]
Check of the formula `\omega^i_{\ \, j} = \Gamma^i_{\ \, jk} e^k`::
Check of the formula `\omega^i_{\ \, j} = \Gamma^i_{\ \, jk} e^k`:
First on the manifold's default frame (d/dx, d/dy, d:dz)::
sage: #... on the manifold's default frame (d/dx, d/dy, d:dz)
sage: dx = M.default_frame().coframe() ; dx
Coordinate coframe (M, (dx,dy,dz))
sage: check = []
sage: for i in M.irange():
....: for j in M.irange():
....: check.append( nab.connection_form(i,j) == \
....: sum( nab[[i,j,k]]*dx[k] for k in M.irange() ) )
....:
sage: check
[True, True, True, True, True, True, True, True, True]
sage: #... on the frame e
Then on the frame e::
sage: ef = e.coframe() ; ef
Coframe (M, (e^1,e^2,e^3))
sage: check = []
sage: for i in M.irange():
....: for j in M.irange():
....: s = nab.connection_form(i,j,e).comp(c_xyz.frame(), from_basis=e)
....: check.append( nab.connection_form(i,j,e) == sum( nab.coef(e)[[i,j,k]]*ef[k] for k in M.irange() ) )
....:
sage: check
[True, True, True, True, True, True, True, True, True]
Expand Down Expand Up @@ -2135,11 +2131,9 @@ def torsion_form(self, i, frame=None):
sage: for i in M.irange(): # long time
....: nab.torsion_form(i, e) == ef[i].exterior_derivative() + \
....: sum(nab.connection_form(i,j,e).wedge(ef[j]) for j in M.irange())
....:
True
True
True
"""
if frame is None:
frame = self._domain._def_frame
Expand Down Expand Up @@ -2245,7 +2239,6 @@ def curvature_form(self, i, j, frame=None):
....: check.append( nab.curvature_form(i,j,e) == \
....: omega(i,j,e).exterior_derivative() + \
....: sum( omega(i,k,e).wedge(omega(k,j,e)) for k in M.irange()) )
....:
sage: check # long time
[True, True, True, True, True, True, True, True, True]
Expand Down
12 changes: 6 additions & 6 deletions src/sage/manifolds/differentiable/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@
- Chap. 1 of [Lee2013]_
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2015 Eric Gourgoulhon <eric.gourgoulhon@obspm.fr>
# Copyright (C) 2015 Michal Bejger <bejger@camk.edu.pl>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.misc.cachefunc import cached_method
from sage.manifolds.chart import Chart, RealChart, CoordChange
from sage.manifolds.differentiable.vectorframe import CoordFrame


class DiffChart(Chart):
r"""
Chart on a differentiable manifold.
Expand Down Expand Up @@ -646,8 +646,8 @@ def symbolic_velocities(self, left='D', right=None):
# is not a string

# If the argument of 'var' contains only one word, for
# instance:
# sage: var('Dt')
# instance::
# var('Dt')
# then 'var' does not return a tuple containing one symbolic
# expression, but the symbolic expression itself.
# This is taken into account below in order to return a list
Expand Down
6 changes: 3 additions & 3 deletions src/sage/manifolds/differentiable/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ def coord_expr(self, chart=None):
sage: U = M.open_subset('U', coord_def={c_xy: (y!=0, x<0)}) # the complement of the segment y=0 and x>0
sage: c_cart = c_xy.restrict(U) # Cartesian coordinates on U
sage: c_spher.<r,ph> = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi') # spherical coordinates on U
sage: # Links between spherical coordinates and Cartesian ones:
Links between spherical coordinates and Cartesian ones::
sage: ch_cart_spher = c_cart.transition_map(c_spher, [sqrt(x*x+y*y), atan2(y,x)])
sage: ch_cart_spher.set_inverse(r*cos(ph), r*sin(ph))
Check of the inverse coordinate transformation:
Expand Down Expand Up @@ -902,12 +904,10 @@ def _graphics(self, plot_curve, ambient_coords, thickness=1,
True
"""

from sage.plot.graphics import Graphics
from sage.plot.line import line
from sage.manifolds.utilities import set_axes_labels


#
# The plot
#
Expand Down
9 changes: 6 additions & 3 deletions src/sage/manifolds/differentiable/levi_civita_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ def coef(self, frame=None):
[[[0, 0, 0], [0, -r, 0], [0, 0, -r*sin(th)^2]],
[[0, 1/r, 0], [1/r, 0, 0], [0, 0, -cos(th)*sin(th)]],
[[0, 0, 1/r], [0, 0, cos(th)/sin(th)], [1/r, cos(th)/sin(th), 0]]]
sage: # The only non-zero Christoffel symbols:
The only non-zero Christoffel symbols::
sage: gam[1,2,2], gam[1,3,3]
(-r, -r*sin(th)^2)
sage: gam[2,1,2], gam[2,3,3]
Expand All @@ -455,14 +457,15 @@ def coef(self, frame=None):
[[[0, 0, 0], [0, -1/r, 0], [0, 0, -1/r]],
[[0, 1/r, 0], [0, 0, 0], [0, 0, -cos(th)/(r*sin(th))]],
[[0, 0, 1/r], [0, 0, cos(th)/(r*sin(th))], [0, 0, 0]]]
sage: # The only non-zero connection coefficients:
The only non-zero connection coefficients::
sage: gam_e[1,2,2], gam_e[2,1,2]
(-1/r, 1/r)
sage: gam_e[1,3,3], gam_e[3,1,3]
(-1/r, 1/r)
sage: gam_e[2,3,3], gam_e[3,2,3]
(-cos(th)/(r*sin(th)), cos(th)/(r*sin(th)))
"""
from sage.manifolds.differentiable.vectorframe import CoordFrame
if frame is None:
Expand Down

0 comments on commit 002b58a

Please sign in to comment.