diff --git a/src/doc/de/tutorial/tour_plotting.rst b/src/doc/de/tutorial/tour_plotting.rst index e7dc377193f..495c5a6943b 100644 --- a/src/doc/de/tutorial/tour_plotting.rst +++ b/src/doc/de/tutorial/tour_plotting.rst @@ -1,3 +1,5 @@ +.. sage-doctest: needs sage.plot sage.symbolic + .. _section-plot: Plotten diff --git a/src/doc/en/developer/packaging_sage_library.rst b/src/doc/en/developer/packaging_sage_library.rst index 0244d96e5ac..44d169c9518 100644 --- a/src/doc/en/developer/packaging_sage_library.rst +++ b/src/doc/en/developer/packaging_sage_library.rst @@ -423,7 +423,7 @@ Apparently it does not in a very substantial way: merely a heuristic. Looking at the source of "entropy", through ``log`` from :mod:`sage.misc.functional`, a runtime dependency on symbolics comes in. In fact, for this reason, two doctests there are - already marked as ``# optional - sage.symbolic``. + already marked as ``# needs sage.symbolic``. So if packaged as **sagemath-coding**, now a domain expert would have to decide whether these dependencies on symbolics are strong enough to diff --git a/src/doc/en/prep/Calculus.rst b/src/doc/en/prep/Calculus.rst index af6902b9e04..c2f636be558 100644 --- a/src/doc/en/prep/Calculus.rst +++ b/src/doc/en/prep/Calculus.rst @@ -1,4 +1,4 @@ -.. -*- coding: utf-8 -*- +.. sage-doctest: needs sage.plot sage.symbolic .. linkall diff --git a/src/doc/en/prep/Quickstarts/Differential-Equations.rst b/src/doc/en/prep/Quickstarts/Differential-Equations.rst index 3c023424db8..94964ccc0a7 100644 --- a/src/doc/en/prep/Quickstarts/Differential-Equations.rst +++ b/src/doc/en/prep/Quickstarts/Differential-Equations.rst @@ -1,4 +1,4 @@ -.. -*- coding: utf-8 -*- +.. sage-doctest: needs sage.plot sage.symbolic .. linkall diff --git a/src/doc/en/prep/Quickstarts/Statistics-and-Distributions.rst b/src/doc/en/prep/Quickstarts/Statistics-and-Distributions.rst index ed7eed79dfc..e83516d6833 100644 --- a/src/doc/en/prep/Quickstarts/Statistics-and-Distributions.rst +++ b/src/doc/en/prep/Quickstarts/Statistics-and-Distributions.rst @@ -142,13 +142,14 @@ the examples in ``r.kruskal_test?`` in the notebook. :: - sage: x=r([2.9, 3.0, 2.5, 2.6, 3.2]) # normal subjects # optional - rpy2 - sage: y=r([3.8, 2.7, 4.0, 2.4]) # with obstructive airway disease # optional - rpy2 - sage: z=r([2.8, 3.4, 3.7, 2.2, 2.0]) # with asbestosis # optional - rpy2 - sage: a = r([x,y,z]) # make a long R vector of all the data # optional - rpy2 - sage: b = r.factor(5*[1]+4*[2]+5*[3]) # create something for R to tell # optional - rpy2 - ....: # which subjects are which - sage: a; b # show them # optional - rpy2 + sage: # optional - rpy2 + sage: x = r([2.9, 3.0, 2.5, 2.6, 3.2]) # normal subjects + sage: y = r([3.8, 2.7, 4.0, 2.4]) # with obstructive airway disease + sage: z = r([2.8, 3.4, 3.7, 2.2, 2.0]) # with asbestosis + sage: a = r([x,y,z]) # make a long R vector of all the data + sage: b = r.factor(5*[1] + 4*[2] + 5*[3]) # create something for R to tell + ....: # which subjects are which + sage: a; b # show them [1] 2.9 3.0 2.5 2.6 3.2 3.8 2.7 4.0 2.4 2.8 3.4 3.7 2.2 2.0 [1] 1 1 1 1 1 2 2 2 2 3 3 3 3 3 Levels: 1 2 3 diff --git a/src/doc/en/prep/Symbolics-and-Basic-Plotting.rst b/src/doc/en/prep/Symbolics-and-Basic-Plotting.rst index 6e0ab69765a..3bc9308669b 100644 --- a/src/doc/en/prep/Symbolics-and-Basic-Plotting.rst +++ b/src/doc/en/prep/Symbolics-and-Basic-Plotting.rst @@ -1,4 +1,4 @@ -.. -*- coding: utf-8 -*- +.. sage-doctest: needs sage.plot sage.symbolic .. linkall diff --git a/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst b/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst index b7d689e5ca3..ca7fdac7197 100644 --- a/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst +++ b/src/doc/en/thematic_tutorials/geometry/polyhedra_tutorial.rst @@ -91,7 +91,7 @@ and some rays. :: - sage: P1 = Polyhedron(vertices = [[1, 0], [0, 1]], rays = [[1, 1]]) + sage: P1 = Polyhedron(vertices=[[1, 0], [0, 1]], rays=[[1, 1]]) sage: P1 A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 2 vertices and 1 ray @@ -118,9 +118,9 @@ We can also add a lineality space. :: - sage: P2 = Polyhedron(vertices = [[1/2, 0, 0], [0, 1/2, 0]], - ....: rays = [[1, 1, 0]], - ....: lines = [[0, 0, 1]]) + sage: P2 = Polyhedron(vertices=[[1/2, 0, 0], [0, 1/2, 0]], + ....: rays=[[1, 1, 0]], + ....: lines=[[0, 0, 1]]) sage: P2 A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 2 vertices, 1 ray, 1 line sage: P2.plot() @@ -144,7 +144,7 @@ The chosen ring depends on the input format. :: - sage: P3 = Polyhedron(vertices = [[0.5, 0], [0, 0.5]]) + sage: P3 = Polyhedron(vertices=[[0.5, 0], [0, 0.5]]) sage: P3 A 1-dimensional polyhedron in RDF^2 defined as the convex hull of 2 vertices sage: P3.parent() @@ -163,22 +163,22 @@ The following example demonstrates the limitations of :code:`RDF`. :: - sage: D = polytopes.dodecahedron() # optional - sage.rings.number_field - sage: D # optional - sage.rings.number_field + sage: D = polytopes.dodecahedron() # needs sage.rings.number_field + sage: D # needs sage.rings.number_field A 3-dimensional polyhedron in (Number Field in sqrt5 with defining polynomial x^2 - 5 with sqrt5 = 2.236067977499790?)^3 defined as the convex hull of 20 vertices - sage: vertices_RDF = [n(v.vector(),digits=6) for v in D.vertices()] # optional - sage.rings.number_field - sage: D_RDF = Polyhedron(vertices=vertices_RDF, base_ring=RDF) # optional - sage.rings.number_field + sage: vertices_RDF = [n(v.vector(),digits=6) for v in D.vertices()] # needs sage.rings.number_field + sage: D_RDF = Polyhedron(vertices=vertices_RDF, base_ring=RDF) # needs sage.rings.number_field doctest:warning ... UserWarning: This polyhedron data is numerically complicated; cdd could not convert between the inexact V and H representation without loss of data. The resulting object might show inconsistencies. - sage: D_RDF = Polyhedron(vertices=sorted(vertices_RDF), base_ring=RDF) # optional - sage.rings.number_field + sage: D_RDF = Polyhedron(vertices=sorted(vertices_RDF), base_ring=RDF) # needs sage.rings.number_field Traceback (most recent call last): ... ValueError: *Error: Numerical inconsistency is found. Use the GMP exact arithmetic. @@ -199,11 +199,12 @@ It is also possible to define a polyhedron over algebraic numbers. :: - sage: sqrt_2 = AA(2)^(1/2) # optional - sage.rings.number_field - sage: cbrt_2 = AA(2)^(1/3) # optional - sage.rings.number_field - sage: timeit('Polyhedron(vertices = [[sqrt_2, 0], [0, cbrt_2]])') # optional - sage.rings.number_field # random + sage: # needs sage.rings.number_field + sage: sqrt_2 = AA(2)^(1/2) + sage: cbrt_2 = AA(2)^(1/3) + sage: timeit('Polyhedron(vertices=[[sqrt_2, 0], [0, cbrt_2]])') # random 5 loops, best of 3: 43.2 ms per loop - sage: P4 = Polyhedron(vertices = [[sqrt_2, 0], [0, cbrt_2]]); P4 # optional - sage.rings.number_field + sage: P4 = Polyhedron(vertices=[[sqrt_2, 0], [0, cbrt_2]]); P4 A 1-dimensional polyhedron in AA^2 defined as the convex hull of 2 vertices .. end of output @@ -212,11 +213,12 @@ There is another way to create a polyhedron over algebraic numbers: :: - sage: K. = NumberField(x^2 - 2, embedding=AA(2)**(1/2)) # optional - sage.rings.number_field - sage: L. = NumberField(x^3 - 2, embedding=AA(2)**(1/3)) # optional - sage.rings.number_field - sage: timeit('Polyhedron(vertices = [[a, 0], [0, b]])') # optional - sage.rings.number_field # random + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^2 - 2, embedding=AA(2)**(1/2)) + sage: L. = NumberField(x^3 - 2, embedding=AA(2)**(1/3)) + sage: timeit('Polyhedron(vertices=[[a, 0], [0, b]])') # random 5 loops, best of 3: 39.9 ms per loop - sage: P5 = Polyhedron(vertices = [[a, 0], [0, b]]); P5 # optional - sage.rings.number_field + sage: P5 = Polyhedron(vertices=[[a, 0], [0, b]]); P5 A 1-dimensional polyhedron in AA^2 defined as the convex hull of 2 vertices .. end of output @@ -225,10 +227,11 @@ If the base ring is known it may be a good option to use the proper :meth:`sage. :: - sage: J = K.composite_fields(L)[0] # optional - sage.rings.number_field - sage: timeit('Polyhedron(vertices = [[J(a), 0], [0, J(b)]])') # optional - sage.rings.number_field # random + sage: # needs sage.rings.number_field + sage: J = K.composite_fields(L)[0] + sage: timeit('Polyhedron(vertices=[[J(a), 0], [0, J(b)]])') # random 25 loops, best of 3: 9.8 ms per loop - sage: P5_comp = Polyhedron(vertices = [[J(a), 0], [0, J(b)]]); P5_comp # optional - sage.rings.number_field + sage: P5_comp = Polyhedron(vertices=[[J(a), 0], [0, J(b)]]); P5_comp A 1-dimensional polyhedron in (Number Field in ab with defining polynomial x^6 - 6*x^4 - 4*x^3 + 12*x^2 - 24*x - 4 @@ -242,9 +245,9 @@ It is not possible to define a polyhedron over it: :: - sage: sqrt_2s = sqrt(2) # optional - sage.symbolic - sage: cbrt_2s = 2^(1/3) # optional - sage.symbolic - sage: Polyhedron(vertices = [[sqrt_2s, 0], [0, cbrt_2s]]) # optional - sage.symbolic + sage: sqrt_2s = sqrt(2) # needs sage.symbolic + sage: cbrt_2s = 2^(1/3) # needs sage.symbolic + sage: Polyhedron(vertices=[[sqrt_2s, 0], [0, cbrt_2s]]) # needs sage.symbolic Traceback (most recent call last): ... ValueError: no default backend for computations with Symbolic Ring @@ -389,7 +392,7 @@ inequalities and equalities as objects. :: - sage: P3_QQ = Polyhedron(vertices = [[0.5, 0], [0, 0.5]], base_ring=QQ) + sage: P3_QQ = Polyhedron(vertices=[[0.5, 0], [0, 0.5]], base_ring=QQ) sage: HRep = P3_QQ.Hrepresentation() sage: H1 = HRep[0]; H1 An equation (2, 2) x - 1 == 0 @@ -527,7 +530,7 @@ In order to use a specific backend, we specify the :code:`backend` parameter. :: - sage: P1_cdd = Polyhedron(vertices = [[1, 0], [0, 1]], rays = [[1, 1]], backend='cdd') + sage: P1_cdd = Polyhedron(vertices=[[1, 0], [0, 1]], rays=[[1, 1]], backend='cdd') sage: P1_cdd A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 2 vertices and 1 ray @@ -567,7 +570,7 @@ The :code:`cdd` backend accepts also entries in :code:`RDF`: :: - sage: P3_cdd = Polyhedron(vertices = [[0.5, 0], [0, 0.5]], backend='cdd') + sage: P3_cdd = Polyhedron(vertices=[[0.5, 0], [0, 0.5]], backend='cdd') sage: P3_cdd A 1-dimensional polyhedron in RDF^2 defined as the convex hull of 2 vertices @@ -577,12 +580,12 @@ but not algebraic or symbolic values: :: - sage: P4_cdd = Polyhedron(vertices = [[sqrt_2, 0], [0, cbrt_2]], backend='cdd') # optional - sage.rings.number_field + sage: P4_cdd = Polyhedron(vertices=[[sqrt_2, 0], [0, cbrt_2]], backend='cdd') # needs sage.rings.number_field Traceback (most recent call last): ... ValueError: No such backend (=cdd) implemented for given basering (=Algebraic Real Field). - sage: P5_cdd = Polyhedron(vertices = [[sqrt_2s, 0], [0, cbrt_2s]], backend='cdd') # optional - sage.symbolic + sage: P5_cdd = Polyhedron(vertices=[[sqrt_2s, 0], [0, cbrt_2s]], backend='cdd') # needs sage.symbolic Traceback (most recent call last): ... ValueError: No such backend (=cdd) implemented for given basering (=Symbolic Ring). @@ -656,8 +659,8 @@ An example with quadratic field: :: - sage: V = polytopes.dodecahedron().vertices_list() # optional - sage.rings.number_field - sage: Polyhedron(vertices=V, backend='polymake') # optional - jupymake # optional - sage.rings.number_field + sage: V = polytopes.dodecahedron().vertices_list() # needs sage.rings.number_field + sage: Polyhedron(vertices=V, backend='polymake') # optional - jupymake # needs sage.rings.number_field A 3-dimensional polyhedron in (Number Field in sqrt5 with defining polynomial x^2 - 5 with sqrt5 = 2.236067977499790?)^3 @@ -681,7 +684,7 @@ examples. :: - sage: type(D) # optional - sage.rings.number_field + sage: type(D) # needs sage.rings.number_field .. end of output @@ -691,13 +694,14 @@ backend :code:`field` is called. :: - sage: P4.parent() # optional - sage.rings.number_field + sage: # needs sage.rings.number_field + sage: P4.parent() Polyhedra in AA^2 - sage: P5.parent() # optional - sage.rings.number_field + sage: P5.parent() Polyhedra in AA^2 - sage: type(P4) # optional - sage.rings.number_field + sage: type(P4) - sage: type(P5) # optional - sage.rings.number_field + sage: type(P5) .. end of output @@ -709,13 +713,15 @@ The fourth backend is :code:`normaliz` and is an optional Sage package. :: - sage: P1_normaliz = Polyhedron(vertices = [[1, 0], [0, 1]], rays = [[1, 1]], backend='normaliz') # optional - pynormaliz - sage: type(P1_normaliz) # optional - pynormaliz + sage: # optional - pynormaliz + sage: P1_normaliz = Polyhedron(vertices=[[1, 0], [0, 1]], rays=[[1, 1]], + ....: backend='normaliz') + sage: type(P1_normaliz) - sage: P2_normaliz = Polyhedron(vertices = [[1/2, 0, 0], [0, 1/2, 0]], # optional - pynormaliz - ....: rays = [[1, 1, 0]], - ....: lines = [[0, 0, 1]], backend='normaliz') - sage: type(P2_normaliz) # optional - pynormaliz + sage: P2_normaliz = Polyhedron(vertices=[[1/2, 0, 0], [0, 1/2, 0]], + ....: rays=[[1, 1, 0]], + ....: lines=[[0, 0, 1]], backend='normaliz') + sage: type(P2_normaliz) .. end of output @@ -724,7 +730,7 @@ This backend does not work with :code:`RDF` or other inexact fields. :: - sage: P3_normaliz = Polyhedron(vertices = [[0.5, 0], [0, 0.5]], backend='normaliz') # optional - pynormaliz + sage: P3_normaliz = Polyhedron(vertices=[[0.5, 0], [0, 0.5]], backend='normaliz') # optional - pynormaliz Traceback (most recent call last): ... ValueError: No such backend (=normaliz) implemented for given basering (=Real Double Field). @@ -738,12 +744,14 @@ the computation is done using an embedded number field. :: - sage: P4_normaliz = Polyhedron(vertices = [[sqrt_2, 0], [0, cbrt_2]], backend='normaliz') # optional - pynormaliz - sage: P4_normaliz # optional - pynormaliz + sage: # optional - pynormaliz + sage: P4_normaliz = Polyhedron(vertices=[[sqrt_2, 0], [0, cbrt_2]], + ....: backend='normaliz') + sage: P4_normaliz A 1-dimensional polyhedron in AA^2 defined as the convex hull of 2 vertices - - sage: P5_normaliz = Polyhedron(vertices = [[sqrt_2s, 0], [0, cbrt_2s]], backend='normaliz') # optional - pynormaliz - sage: P5_normaliz # optional - pynormaliz + sage: P5_normaliz = Polyhedron(vertices=[[sqrt_2s, 0], [0, cbrt_2s]], + ....: backend='normaliz') + sage: P5_normaliz A 1-dimensional polyhedron in (Symbolic Ring)^2 defined as the convex hull of 2 vertices .. end of output @@ -753,12 +761,14 @@ The backend :code:`normaliz` provides other methods such as :: - sage: P6 = Polyhedron(vertices = [[0, 0], [3/2, 0], [3/2, 3/2], [0, 3]], backend='normaliz') # optional - pynormaliz - sage: IH = P6.integral_hull(); IH # optional - pynormaliz + sage: # optional - pynormaliz + sage: P6 = Polyhedron(vertices=[[0, 0], [3/2, 0], [3/2, 3/2], [0, 3]], + ....: backend='normaliz') + sage: IH = P6.integral_hull(); IH A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 4 vertices - sage: P6.plot(color='blue')+IH.plot(color='red') # optional - pynormaliz + sage: P6.plot(color='blue') + IH.plot(color='red') Graphics object consisting of 12 graphics primitives - sage: P1_normaliz.integral_hull() # optional - pynormaliz + sage: P1_normaliz.integral_hull() A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 2 vertices and 1 ray .. end of output @@ -788,7 +798,7 @@ polytope is already defined! :: - sage: A = polytopes.buckyball(); A # can take long # optional - sage.rings.number_field + sage: A = polytopes.buckyball(); A # can take long # needs sage.rings.number_field A 3-dimensional polyhedron in (Number Field in sqrt5 with defining polynomial x^2 - 5 with sqrt5 = 2.236067977499790?)^3 diff --git a/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst b/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst index ba6cfb5fb86..56ffac780ad 100644 --- a/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst +++ b/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst @@ -28,15 +28,16 @@ by :: - sage: import numpy # optional - cvxopt - sage: from cvxopt.base import spmatrix # optional - cvxopt - sage: from cvxopt.base import matrix as m # optional - cvxopt - sage: from cvxopt import umfpack # optional - cvxopt - sage: Integer = int # optional - cvxopt - sage: V = [2,3, 3,-1,4, 4,-3,1,2, 2, 6,1] # optional - cvxopt - sage: I = [0,1, 0, 2,4, 1, 2,3,4, 2, 1,4] # optional - cvxopt - sage: J = [0,0, 1, 1,1, 2, 2,2,2, 3, 4,4] # optional - cvxopt - sage: A = spmatrix(V,I,J) # optional - cvxopt + sage: # needs cvxopt + sage: import numpy + sage: from cvxopt.base import spmatrix + sage: from cvxopt.base import matrix as m + sage: from cvxopt import umfpack + sage: Integer = int + sage: V = [2,3, 3,-1,4, 4,-3,1,2, 2, 6,1] + sage: I = [0,1, 0, 2,4, 1, 2,3,4, 2, 1,4] + sage: J = [0,0, 1, 1,1, 2, 2,2,2, 3, 4,4] + sage: A = spmatrix(V,I,J) To solve an equation :math:`AX=B`, with :math:`B=[1,1,1,1,1]`, we could do the following. @@ -45,9 +46,9 @@ we could do the following. :: - sage: B = numpy.array([1.0]*5) # optional - cvxopt - sage: B.shape=(5,1) # optional - cvxopt - sage: print(B) # optional - cvxopt + sage: B = numpy.array([1.0]*5) # needs cvxopt + sage: B.shape=(5,1) # needs cvxopt + sage: print(B) # needs cvxopt [[1.] [1.] [1.] @@ -55,15 +56,16 @@ we could do the following. [1.]] - sage: print(A) # optional - cvxopt + sage: # needs cvxopt + sage: print(A) [ 2.00e+00 3.00e+00 0 0 0 ] [ 3.00e+00 0 4.00e+00 0 6.00e+00] [ 0 -1.00e+00 -3.00e+00 2.00e+00 0 ] [ 0 0 1.00e+00 0 0 ] [ 0 4.00e+00 2.00e+00 0 1.00e+00] - sage: C = m(B) # optional - cvxopt - sage: umfpack.linsolve(A,C) # optional - cvxopt - sage: print(C) # optional - cvxopt + sage: C = m(B) + sage: umfpack.linsolve(A,C) + sage: print(C) [ 5.79e-01] [-5.26e-02] [ 1.00e+00] @@ -81,13 +83,14 @@ We could compute the approximate minimum degree ordering by doing :: - sage: RealNumber = float # optional - cvxopt - sage: Integer = int # optional - cvxopt - sage: from cvxopt.base import spmatrix # optional - cvxopt - sage: from cvxopt import amd # optional - cvxopt - sage: A = spmatrix([10,3,5,-2,5,2],[0,2,1,2,2,3],[0,0,1,1,2,3]) # optional - cvxopt - sage: P = amd.order(A) # optional - cvxopt - sage: print(P) # optional - cvxopt + sage: # needs cvxopt + sage: RealNumber = float + sage: Integer = int + sage: from cvxopt.base import spmatrix + sage: from cvxopt import amd + sage: A = spmatrix([10,3,5,-2,5,2],[0,2,1,2,2,3],[0,0,1,1,2,3]) + sage: P = amd.order(A) + sage: print(P) [ 1] [ 0] [ 2] @@ -108,14 +111,15 @@ For a simple linear programming example, if we want to solve :: - sage: RealNumber = float # optional - cvxopt - sage: Integer = int # optional - cvxopt - sage: from cvxopt.base import matrix as m # optional - cvxopt - sage: from cvxopt import solvers # optional - cvxopt - sage: c = m([-4., -5.]) # optional - cvxopt - sage: G = m([[2., 1., -1., 0.], [1., 2., 0., -1.]]) # optional - cvxopt - sage: h = m([3., 3., 0., 0.]) # optional - cvxopt - sage: sol = solvers.lp(c,G,h) # random # optional - cvxopt + sage: # needs cvxopt + sage: RealNumber = float + sage: Integer = int + sage: from cvxopt.base import matrix as m + sage: from cvxopt import solvers + sage: c = m([-4., -5.]) + sage: G = m([[2., 1., -1., 0.], [1., 2., 0., -1.]]) + sage: h = m([3., 3., 0., 0.]) + sage: sol = solvers.lp(c,G,h) # random pcost dcost gap pres dres k/t 0: -8.1000e+00 -1.8300e+01 4e+00 0e+00 8e-01 1e+00 1: -8.8055e+00 -9.4357e+00 2e-01 1e-16 4e-02 3e-02 @@ -127,6 +131,6 @@ For a simple linear programming example, if we want to solve :: - sage: print(sol['x']) # optional - cvxopt # ... below since can get -00 or +00 depending on architecture + sage: print(sol['x']) # ... below since can get -00 or +00 depending on architecture # needs cvxopt [ 1.00e...00] [ 1.00e+00] diff --git a/src/doc/en/thematic_tutorials/steenrod_algebra_modules.rst b/src/doc/en/thematic_tutorials/steenrod_algebra_modules.rst index f038ff7acaa..6a096608c68 100644 --- a/src/doc/en/thematic_tutorials/steenrod_algebra_modules.rst +++ b/src/doc/en/thematic_tutorials/steenrod_algebra_modules.rst @@ -41,7 +41,8 @@ with relations, the coefficients for each relation is given:: sage: r1 = [Sq(8), Sq(7), 0] # First relation sage: r2 = [Sq(7), 0, 1] # Second relation sage: M = SteenrodFPModule(A, [0, 1, 7], relations=[r1, r2]); M - Finitely presented left module on 3 generators and 2 relations over mod 2 Steenrod algebra, milnor basis + Finitely presented left module on 3 generators and 2 relations + over mod 2 Steenrod algebra, milnor basis The resulting module will have three generators in the degrees we gave them:: @@ -156,8 +157,8 @@ A vector space presentation can be produced:: Vector space quotient V/W of dimension 4 over Finite Field of size 2 where V: Vector space of dimension 4 over Finite Field of size 2 W: Vector space of degree 4 and dimension 0 over Finite Field of size 2 - Basis matrix: - [] + Basis matrix: + [] Given any element, its coordinates with respect to this basis can be computed:: @@ -188,11 +189,13 @@ such homomorphisms using the function ``Hom``:: sage: Hko = SteenrodFPModule(A, [0], [[Sq(2)], [Sq(1)]]) sage: homspace = Hom(Hko, Hko); homspace - Set of Morphisms from Finitely presented left module on 1 generator and 2 relations - over mod 2 Steenrod algebra, milnor basis - to Finitely presented left module on 1 generator and 2 relations - over mod 2 Steenrod algebra, milnor basis - in Category of finitely presented graded modules over mod 2 Steenrod algebra, milnor basis + Set of Morphisms + from Finitely presented left module on 1 generator and 2 relations + over mod 2 Steenrod algebra, milnor basis + to Finitely presented left module on 1 generator and 2 relations + over mod 2 Steenrod algebra, milnor basis + in Category of finitely presented graded modules + over mod 2 Steenrod algebra, milnor basis Just as with module elements, homomorphisms are created using the homspace. The only argument is a list of elements in the codomain, giving the @@ -207,7 +210,8 @@ The resulting homomorphism is the one sending the `i`-th generator of the domain to the `i`-th codomain value given:: sage: f - Module endomorphism of Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis + Module endomorphism of Finitely presented left module on 1 generator + and 2 relations over mod 2 Steenrod algebra, milnor basis Defn: g[0] |--> Sq(0,0,1)*g[0] Homomorphisms can be evaluated on elements of the domain module:: @@ -232,7 +236,8 @@ Convenience methods exist for creating the trivial morphism:: sage: x == 0 False sage: zero_map = homspace.zero(); zero_map - Module endomorphism of Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis + Module endomorphism of Finitely presented left module on 1 generator + and 2 relations over mod 2 Steenrod algebra, milnor basis Defn: g[0] |--> 0 sage: zero_map(x) 0 @@ -242,7 +247,8 @@ Convenience methods exist for creating the trivial morphism:: as well as the identity endomorphism:: sage: one = Hom(Hko, Hko).identity(); one - Module endomorphism of Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis + Module endomorphism of Finitely presented left module on 1 generator + and 2 relations over mod 2 Steenrod algebra, milnor basis Defn: g[0] |--> g[0] sage: one.is_endomorphism() True @@ -271,7 +277,8 @@ Any two homomorphisms can be added as long as they are of the same degree:: sage: (f1 + f2).is_zero() False sage: f1 + f2 - Module endomorphism of Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis + Module endomorphism of Finitely presented left module on 1 generator + and 2 relations over mod 2 Steenrod algebra, milnor basis Defn: g[0] |--> (Sq(0,0,3)+Sq(0,2,0,1)+Sq(8,2,1))*g[0] or when at least one of them is zero:: @@ -302,32 +309,32 @@ elements is a linear transformation:: [1 0 0 0 0 0] [0 0 0 0 0 0] [1 0 0 0 0 0] - Domain: Vector space quotient V/W of dimension 3 over Finite Field of size 2 where - V: Vector space of dimension 20 over Finite Field of size 2 - W: Vector space of degree 20 and dimension 17 over Finite Field of size 2 - Basis matrix: - [1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0] - [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] - [0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0] - [0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1] - [0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1] - [0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1] - [0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1] - [0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1] - [0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0] - [0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1] - [0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0] - [0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1] - [0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1] - [0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1] - [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1] - [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0] - [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1] + Domain: Vector space quotient V/W of dimension 3 over Finite Field of size 2 where + V: Vector space of dimension 20 over Finite Field of size 2 + W: Vector space of degree 20 and dimension 17 over Finite Field of size 2 + Basis matrix: + [1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0] + [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] + [0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0] + [0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1] + [0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1] + [0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1] + [0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1] + [0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1] + [0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1] + [0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0] + [0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1] + [0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0] + [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1] Codomain: Vector space quotient V/W of dimension 6 over Finite Field of size 2 where - V: Vector space of dimension 35 over Finite Field of size 2 - W: Vector space of degree 35 and dimension 29 over Finite Field of size 2 - Basis matrix: - 29 x 35 dense matrix over Finite Field of size 2 + V: Vector space of dimension 35 over Finite Field of size 2 + W: Vector space of degree 35 and dimension 29 over Finite Field of size 2 + Basis matrix: + 29 x 35 dense matrix over Finite Field of size 2 This is compatible with the vector presentations of its domain and codomain modules:: @@ -352,13 +359,13 @@ Elements in the preimage of a homomorphism can be found:: Homomorphisms can be composed as expected:: sage: g = homspace([Sq(0, 0, 0, 1)*gen]); g - Module endomorphism of Finitely presented left module on 1 generator and 2 relations - over mod 2 Steenrod algebra, milnor basis + Module endomorphism of Finitely presented left module on 1 generator + and 2 relations over mod 2 Steenrod algebra, milnor basis Defn: g[0] |--> Sq(0,0,0,1)*g[0] sage: g*f - Module endomorphism of Finitely presented left module on 1 generator and 2 relations - over mod 2 Steenrod algebra, milnor basis + Module endomorphism of Finitely presented left module on 1 generator + and 2 relations over mod 2 Steenrod algebra, milnor basis Defn: g[0] |--> Sq(0,0,1,1)*g[0] sage: one = homspace.identity() @@ -412,13 +419,15 @@ homomorphism of free modules. We then construct a candidate for an isomorphism and check that it is both injective and surjective:: sage: HZ = SteenrodFPModule(A, [0], [[Sq(1)]]); HZ - Finitely presented left module on 1 generator and 1 relation over mod 2 Steenrod algebra, milnor basis + Finitely presented left module on 1 generator and 1 relation + over mod 2 Steenrod algebra, milnor basis sage: F = SteenrodFPModule(A, [0]) sage: j = Hom(F, F)([Sq(1)*F.generator(0)]) - sage: coker = j.cokernel_projection() # the natural quotient homomorphism onto the cokernel. + sage: coker = j.cokernel_projection() # the natural quotient homomorphism onto the cokernel. sage: hz = coker.codomain(); hz - Finitely presented left module on 1 generator and 1 relation over mod 2 Steenrod algebra, milnor basis + Finitely presented left module on 1 generator and 1 relation + over mod 2 Steenrod algebra, milnor basis sage: a = Hom(HZ, hz)([hz.generator(0)]) sage: a.is_injective() @@ -435,8 +444,10 @@ injective homomorphism into the domain of `f`:: sage: k = f.kernel_inclusion(); k Module morphism: - From: Finitely presented left module on 1 generator and 3 relations over mod 2 Steenrod algebra, milnor basis - To: Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis + From: Finitely presented left module on 1 generator and 3 relations + over mod 2 Steenrod algebra, milnor basis + To: Finitely presented left module on 1 generator and 2 relations + over mod 2 Steenrod algebra, milnor basis Defn: g[7] |--> Sq(0,0,1)*g[0] sage: k.codomain() == f.domain() True @@ -445,7 +456,8 @@ injective homomorphism into the domain of `f`:: sage: ker = k.domain() sage: ker - Finitely presented left module on 1 generator and 3 relations over mod 2 Steenrod algebra, milnor basis + Finitely presented left module on 1 generator and 3 relations + over mod 2 Steenrod algebra, milnor basis We can check that the injective image of `k` is the kernel of `f` by showing that `f` factors as `h\circ c`, where `c` is the quotient map @@ -470,8 +482,10 @@ equal to the submodule `\operatorname{im}(f)`:: sage: i = f.image(); i Module morphism: - From: Finitely presented left module on 1 generator and 3 relations over mod 2 Steenrod algebra, milnor basis - To: Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis + From: Finitely presented left module on 1 generator and 3 relations + over mod 2 Steenrod algebra, milnor basis + To: Finitely presented left module on 1 generator and 2 relations + over mod 2 Steenrod algebra, milnor basis Defn: g[7] |--> Sq(0,0,1)*g[0] sage: i.codomain() == f.codomain() True @@ -483,8 +497,10 @@ lifting `f` over `i`, and showing that the lift is surjective:: sage: f_ = f.lift(i); f_ Module morphism: - From: Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis - To: Finitely presented left module on 1 generator and 3 relations over mod 2 Steenrod algebra, milnor basis + From: Finitely presented left module on 1 generator and 2 relations + over mod 2 Steenrod algebra, milnor basis + To: Finitely presented left module on 1 generator and 3 relations + over mod 2 Steenrod algebra, milnor basis Defn: g[0] |--> g[7] sage: i*f_ == f # Is im(i) contained in im(f) ? True @@ -501,7 +517,8 @@ domain `\ker(g)`:: sage: K = f.kernel_inclusion() # k: ker(f) -> Hko sage: h = f.homology(f) # h: ker(f) -> ker(f) / im(f) sage: h.codomain() # This is the homology module. - Finitely presented left module on 1 generator and 4 relations over mod 2 Steenrod algebra, milnor basis + Finitely presented left module on 1 generator and 4 relations + over mod 2 Steenrod algebra, milnor basis Free resolutions @@ -632,8 +649,10 @@ The projection:: sage: q = Hom(HZ, Hko)([Hko.generator(0)]) sage: q Module morphism: - From: Finitely presented left module on 1 generator and 1 relation over mod 2 Steenrod algebra, milnor basis - To: Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis + From: Finitely presented left module on 1 generator and 1 relation + over mod 2 Steenrod algebra, milnor basis + To: Finitely presented left module on 1 generator and 2 relations + over mod 2 Steenrod algebra, milnor basis Defn: g[0] |--> g[0] The map to lift over `q`:: @@ -641,8 +660,10 @@ The map to lift over `q`:: sage: f = Hom(L, Hko)([Sq(0,2,1,1)*Hko.generator(0)]) sage: f Module morphism: - From: Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis - To: Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis + From: Finitely presented left module on 1 generator and 2 relations + over mod 2 Steenrod algebra, milnor basis + To: Finitely presented left module on 1 generator and 2 relations + over mod 2 Steenrod algebra, milnor basis Defn: g[28] |--> Sq(0,2,1,1)*g[0] sage: f.is_zero() # f is non-trivial. @@ -703,8 +724,10 @@ Start by finding a single lift of `f` over the projection `q`:: sage: fl = f.lift(q); fl Module morphism: - From: Finitely presented left module on 1 generator and 2 relations over mod 2 Steenrod algebra, milnor basis - To: Finitely presented left module on 1 generator and 1 relation over mod 2 Steenrod algebra, milnor basis + From: Finitely presented left module on 1 generator and 2 relations + over mod 2 Steenrod algebra, milnor basis + To: Finitely presented left module on 1 generator and 1 relation + over mod 2 Steenrod algebra, milnor basis Defn: g[28] |--> (Sq(4,3,0,1)+Sq(6,0,1,1)+Sq(7,2,0,1)+Sq(10,1,0,1))*g[0] We verify that ``fl`` is indeed a lift:: diff --git a/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_advanced.rst b/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_advanced.rst index 104933d7bc8..7bd9934cffd 100644 --- a/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_advanced.rst +++ b/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_advanced.rst @@ -1,4 +1,4 @@ -.. -*- coding: utf-8 -*- +.. sage-doctest: needs sage.plot sage.symbolic .. linkall diff --git a/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_cartesian.rst b/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_cartesian.rst index 978aa129395..51300f93bc1 100644 --- a/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_cartesian.rst +++ b/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_cartesian.rst @@ -1,4 +1,4 @@ -.. -*- coding: utf-8 -*- +.. sage-doctest: needs sage.plot sage.symbolic .. linkall diff --git a/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_change.rst b/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_change.rst index d7164e7c363..029c5727435 100644 --- a/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_change.rst +++ b/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_change.rst @@ -1,4 +1,4 @@ -.. -*- coding: utf-8 -*- +.. .. sage-doctest: needs sage.plot sage.symbolic .. linkall diff --git a/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_curvilinear.rst b/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_curvilinear.rst index bdcff4b9af8..af11769e274 100644 --- a/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_curvilinear.rst +++ b/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_curvilinear.rst @@ -1,4 +1,4 @@ -.. -*- coding: utf-8 -*- +.. sage-doctest: needs sage.plot sage.symbolic .. linkall diff --git a/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_plane.rst b/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_plane.rst index 59c4270badb..921724105a0 100644 --- a/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_plane.rst +++ b/src/doc/en/thematic_tutorials/vector_calculus/vector_calc_plane.rst @@ -1,4 +1,4 @@ -.. -*- coding: utf-8 -*- +.. sage-doctest: needs sage.plot sage.symbolic .. linkall diff --git a/src/doc/en/tutorial/tour_plotting.rst b/src/doc/en/tutorial/tour_plotting.rst index a218f70ff1e..ad861c3ca56 100644 --- a/src/doc/en/tutorial/tour_plotting.rst +++ b/src/doc/en/tutorial/tour_plotting.rst @@ -1,3 +1,5 @@ +.. sage-doctest: needs sage.plot sage.symbolic + .. _section-plot: Plotting diff --git a/src/doc/es/tutorial/tour_rings.rst b/src/doc/es/tutorial/tour_rings.rst index 1bdee618525..fd7af3f72d2 100644 --- a/src/doc/es/tutorial/tour_rings.rst +++ b/src/doc/es/tutorial/tour_rings.rst @@ -131,7 +131,7 @@ y anillos de matrices. Veamos algunos de estos anillos:: sage: GF(3) Finite Field of size 3 sage: # es necesario dar un nombre al generador si el número - sage: GF(27, 'a') # de elementos no es primo + sage: GF(27, 'a') # de elementos no es primo Finite Field in a of size 3^3 sage: Zp(5) 5-adic Ring with capped relative precision 20 diff --git a/src/doc/fr/tutorial/tour_plotting.rst b/src/doc/fr/tutorial/tour_plotting.rst index 6233d33db53..3815125ed19 100644 --- a/src/doc/fr/tutorial/tour_plotting.rst +++ b/src/doc/fr/tutorial/tour_plotting.rst @@ -1,3 +1,5 @@ +.. sage-doctest: needs sage.plot sage.symbolic + .. _section-plot: Graphiques diff --git a/src/doc/ja/tutorial/tour_plotting.rst b/src/doc/ja/tutorial/tour_plotting.rst index 07f65fc3fdf..baf450fd6eb 100644 --- a/src/doc/ja/tutorial/tour_plotting.rst +++ b/src/doc/ja/tutorial/tour_plotting.rst @@ -1,3 +1,5 @@ +.. sage-doctest: needs sage.plot sage.symbolic + .. _section-plot: プロットする diff --git a/src/doc/pt/tutorial/tour_plotting.rst b/src/doc/pt/tutorial/tour_plotting.rst index 1fb3d910dfc..dacf25e063b 100644 --- a/src/doc/pt/tutorial/tour_plotting.rst +++ b/src/doc/pt/tutorial/tour_plotting.rst @@ -1,3 +1,5 @@ +.. sage-doctest: needs sage.plot sage.symbolic + .. _section-plot: Gráficos diff --git a/src/doc/ru/tutorial/tour_plotting.rst b/src/doc/ru/tutorial/tour_plotting.rst index 76f6c1ef6a3..f4a755e412e 100644 --- a/src/doc/ru/tutorial/tour_plotting.rst +++ b/src/doc/ru/tutorial/tour_plotting.rst @@ -1,3 +1,5 @@ +.. sage-doctest: needs sage.plot sage.symbolic + .. _section-plot: Построение графиков