Skip to content

Commit 39f8d6d

Browse files
committed
various fixes, including python3 prints
1 parent 52b611d commit 39f8d6d

13 files changed

+77
-75
lines changed

2009-01-01-SienaTutorials/Worksheet09-CombinatoricsIteratorsGenerators.rst

+15-15
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,28 @@ The Python command ``iter`` returns an iterator from an object (the object its
5050
5151
::
5252

53-
sage: it.next()
53+
sage: next(it)
5454
1
5555

5656
.. end of output
5757
5858
::
5959

60-
sage: it.next()
60+
sage: next(it)
6161
2
6262

6363
.. end of output
6464
6565
::
6666

67-
sage: it.next()
67+
sage: next(it)
6868
3
6969

7070
.. end of output
7171
7272
::
7373

74-
sage: it.next()
74+
sage: next(it)
7575
Traceback (most recent call last):
7676
...
7777
StopIteration
@@ -101,42 +101,42 @@ A *generator* is a function that is used to define an iterator. Instead of ``
101101
102102
::
103103

104-
sage: f.next()
104+
sage: next(f)
105105
1
106106

107107
.. end of output
108108
109109
::
110110

111-
sage: f.next()
111+
sage: next(f)
112112
1
113113

114114
.. end of output
115115
116116
::
117117

118-
sage: f.next()
118+
sage: next(f)
119119
2
120120

121121
.. end of output
122122
123123
::
124124

125-
sage: f.next()
125+
sage: next(f)
126126
3
127127

128128
.. end of output
129129
130130
::
131131

132-
sage: f.next()
132+
sage: next(f)
133133
5
134134

135135
.. end of output
136136
137137
::
138138

139-
sage: f.next()
139+
sage: next(f)
140140
8
141141

142142
.. end of output
@@ -246,7 +246,7 @@ There are many objects in Sage that model sets of combinatorial objects.
246246
::
247247

248248
sage: for p in Partitions(4):
249-
....: print p
249+
....: print(p)
250250
[4]
251251
[3, 1]
252252
[2, 2]
@@ -258,7 +258,7 @@ There are many objects in Sage that model sets of combinatorial objects.
258258
::
259259

260260
sage: for c in Compositions(4):
261-
....: print c
261+
....: print(c)
262262
[1, 1, 1, 1]
263263
[1, 1, 2]
264264
[1, 2, 1]
@@ -288,7 +288,7 @@ There are many objects in Sage that model sets of combinatorial objects.
288288
::
289289

290290
sage: for dw in DyckWords(4):
291-
....: print dw
291+
....: print(dw)
292292
()()()()
293293
()()(())
294294
()(())()
@@ -326,7 +326,7 @@ There are many objects in Sage that model sets of combinatorial objects.
326326

327327
sage: it = iter(W)
328328
sage: for a in range(16):
329-
....: print it.next()
329+
....: print(next(it))
330330
word:
331331
word: a
332332
word: b
@@ -367,7 +367,7 @@ There are many objects in Sage that model sets of combinatorial objects.
367367

368368
sage: it = iter(P)
369369
sage: for a in range(10):
370-
....: print it.next()
370+
....: print(next(it))
371371
Finite poset containing 0 elements
372372
Finite poset containing 1 elements
373373
Finite poset containing 2 elements

2010-03-29-SLC64.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Enumerated sets (combinatorial classes)
122122
[1, 1, 3, 1, 2, 1, 1]
123123

124124
sage: for p in StandardTableaux([3,2]):
125-
....: print "-----------------------------"
125+
....: print("-----------------------------")
126126
....: p.pp()
127127
-----------------------------
128128
1 3 5
@@ -188,7 +188,7 @@ Constructions
188188
+Infinity
189189

190190
sage: for p in U:
191-
....: print p
191+
....: print(p)
192192
[]
193193
[1]
194194
[1, 2]
@@ -335,13 +335,13 @@ Root systems, Coxeter groups, ...
335335
sage: W = WeylGroup(["B", 3])
336336
sage: W.cayley_graph(side = "left").plot3d(color_by_label = True)
337337

338-
sage: print W.character_table() # Thanks GAP!
338+
sage: print(W.character_table()) # Thanks GAP!
339339
CT1
340340

341-
2 4 4 3 3 4 3 1 1 3 4
342-
3 1 . . . . . 1 1 . 1
341+
2 4 4 3 3 4 3 1 1 3 4
342+
3 1 . . . . . 1 1 . 1
343343

344-
1a 2a 2b 4a 2c 2d 6a 3a 4b 2e
344+
1a 2a 2b 4a 2c 2d 6a 3a 4b 2e
345345

346346
X.1 1 1 1 1 1 1 1 1 1 1
347347
X.2 1 1 1 -1 -1 -1 -1 1 1 -1

2010-12-11-Nikolaus.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ GAP at work
117117

118118
::
119119

120-
sage: print W.character_table() # Thanks GAP!
120+
sage: print(W.character_table()) # Thanks GAP!
121121
CT1
122122

123-
2 4 4 3 3 4 3 1 1 3 4
124-
3 1 . . . . . 1 1 . 1
123+
2 4 4 3 3 4 3 1 1 3 4
124+
3 1 . . . . . 1 1 . 1
125125

126-
1a 2a 2b 4a 2c 2d 6a 3a 4b 2e
126+
1a 2a 2b 4a 2c 2d 6a 3a 4b 2e
127127

128128
X.1 1 1 1 1 1 1 1 1 1 1
129129
X.2 1 1 1 -1 -1 -1 -1 1 1 -1

2011-05-23-SMAI.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ factorisation::
116116
6*(3*x + 1)^2*(x^2 - 2)
117117

118118
sage: for A in [ZZ, QQ, ComplexField(16), QQ[sqrt(2)], GF(5)]:
119-
....: print A, ":"; print A['x'](p).factor()
119+
....: print(A, ":"); print(A['x'](p).factor())
120120
Integer Ring :
121121
2 * 3 * (3*x + 1)^2 * (x^2 - 2)
122122
Rational Field :
@@ -523,7 +523,7 @@ On trouve alors un indépendant de taille quatre::
523523
4.0
524524

525525
sage: b_sol = LP.get_values(b)
526-
sage: print b_sol
526+
sage: print(b_sol)
527527
{0: 0.0, 1: 1.0, 2: 0.0, 3: 0.0, 4: 1.0, 5: 0.0, 6: 0.0, 7: 1.0, 8: 1.0, 9: 0.0}
528528

529529
sage: I = [ v for v in petersen.vertices() if b_sol[v] ]; I
@@ -612,7 +612,7 @@ En quoi est-ce utile?
612612
hierarchie de classes::
613613

614614
sage: for cls in K.__class__.mro():
615-
....: print cls
615+
....: print(cls)
616616
<class 'sage.rings.finite_rings.finite_field_prime_modn.FiniteField_prime_modn_with_category'>
617617
...
618618
<class 'sage.categories.finite_fields.FiniteFields.parent_class'>
@@ -793,7 +793,7 @@ Let's try now the 0-Hecke monoid::
793793
sage: H = S.algebra(QQ)
794794
sage: H._repr_term = lambda x: '['+''.join(str(i) for i in x.reduced_word())+']'
795795
sage: for x in H.orthogonal_idempotents():
796-
....: print x
796+
....: print(x)
797797
[121321]
798798
-[121321] - [21321] + [2132] + [13] - [12132] + [2321] - [132] + [1213] - [12321] + [1232] + [1321] - [213]
799799
[232] - [2321] - [1232] + [12321]

2012-10-29-CIMPA-Bobo/combinatoire-des-mots.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -319,34 +319,34 @@ Périodes, répétitions
319319

320320
::
321321

322-
sage: w = Word("abaabaa")
323-
sage: w.periods()
324-
[3, 6]
322+
sage: w = Word("abaabaa")
323+
sage: w.periods()
324+
[3, 6]
325325

326326
On note que Sage, comme pas mal de chercheurs, appellent période
327327
la longueur du mot `x` et non le mot lui-même. Voici les mots
328328
correspondants::
329329

330-
sage: w[:3]
331-
word: aba
332-
sage: w[:6]
333-
word: abaaba
330+
sage: w[:3]
331+
word: aba
332+
sage: w[:6]
333+
word: abaaba
334334

335335
On peut avoir directement toutes les périodes comme mots::
336336

337337
sage: [w[:i] for i in w.periods()]
338-
[word: aba, word: abaaba]
338+
[word: aba, word: abaaba]
339339

340340
.. WARNING:: Sage ne considère pas `w` comme une période de lui-même!?!
341341

342342
Un autre exemple montrant qu'il n'y a pas forcément une unique
343343
période primitive::
344344

345345
sage: w = Word("aaabaaaa")
346-
sage: sage: sage: w.periods()
347-
[5, 6, 7]
346+
sage: w.periods()
347+
[5, 6, 7]
348348
sage: [w[:i] for i in w.periods()]
349-
[word: aaaba, word: aaabaa, word: aaabaaa]
349+
[word: aaaba, word: aaabaa, word: aaabaaa]
350350

351351

352352
.. TOPIC:: Proposition

agregation-option-calcul-formel/codes_correcteurs.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ Commençons par un petit échauffement.
393393

394394
Solution::
395395

396-
sage: sage: C.cardinality()
396+
sage: C.cardinality()
397397
16
398398
sage: def poids(c): return len([i for i in c if i])
399399
sage: poids(V([0,1,0,0,0,0,0]))

demo-basics.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ Demonstration: Basics
77
Arithmetic::
88

99
sage: 1 + 1
10+
2
1011

1112
sage: 1 + 3
13+
4
1214

1315
sage: ( 1 + 2 * (3 + 5)^2 ) * 2
1416
258
@@ -43,12 +45,12 @@ Polynomials::
4345
Symbolic calculations::
4446

4547
sage: var('x,y')
48+
(x, y)
4649
sage: f = sin(x) - cos(x*y) + 1 / (x^3+1)
4750
sage: f
48-
49-
::
50-
51+
1/(x^3 + 1) - cos(x*y) + sin(x)
5152
sage: f.integrate(x)
53+
1/3*sqrt(3)*arctan(1/3*sqrt(3)*(2*x - 1)) ...
5254

5355
.. Next example taken from Calcul mathématique avec Sage
5456
@@ -79,7 +81,7 @@ Symbolic calculations::
7981

8082
Statistics::
8183

82-
sage: print r.summary(r.c(1,2,3,111,2,3,2,3,2,5,4))
84+
sage: print(r.summary(r.c(1,2,3,111,2,3,2,3,2,5,4)))
8385

8486

8587
.. todo:: other examples from MuPAD-Combinat/lib/DOC/demo/mupad.tex

demo-constructions-categories-short.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Demonstration: Algebraic constructions and categories
1414

1515
::
1616

17-
sage: for category in Fx.categories(): print category
17+
sage: for category in Fx.categories(): print(category)
1818

1919
::
2020

demo-monoids-jtrivial.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ Demonstration: A real life example, parallel testing of a conjecture on J-Trivia
5050
::
5151

5252
sage: MuMon = mupad(Mon); MuMon
53-
/ +- -+ \
54-
| | 0, 1, 2, 3, 4 | |
55-
| | | |
56-
| | 1, 1, 4, 4, 4 | |
57-
| | | |
53+
/ +- -+ \
54+
| | 0, 1, 2, 3, 4 | |
55+
| | | |
56+
| | 1, 1, 4, 4, 4 | |
57+
| | | |
5858
Dom::MMonoid| | 2, 3, 2, 3, 4 | |
59-
| | | |
60-
| | 3, 3, 4, 4, 4 | |
61-
| | | |
62-
| | 4, 4, 4, 4, 4 | |
63-
\ +- -+ /
59+
| | | |
60+
| | 3, 3, 4, 4, 4 | |
61+
| | | |
62+
| | 4, 4, 4, 4, 4 | |
63+
\ +- -+ /
6464

6565
sage: MuMon.count()
6666
5
@@ -145,7 +145,7 @@ Demonstration: A real life example, parallel testing of a conjecture on J-Trivia
145145
....: return is_isomorphic_matrices(MP.cartan_matrix(q),
146146
....: MP.cartan_matrix_mupad(q))
147147

148-
sage: for (((poset,), _), res) in check_conj_parallel(Posets(3).list()): print poset.cover_relations(), res
148+
sage: for (((poset,), _), res) in check_conj_parallel(Posets(3).list()): print(poset.cover_relations(), res)
149149

150150
sage: all(x[1] for x in check_conj_parallel(Posets(4).list()))
151151
True

demo-number-theory.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Use *matplotlib* to plot it::
1616

1717
Use *mwrank* to do a 2-descent::
1818

19-
sage: print E.mwrank()
19+
sage: print(E.mwrank())
2020
Curve [0,1,1,-2,0] : Rank = 2
2121

2222
*PARI* to compute Fourier coefficients `a_n`::

0 commit comments

Comments
 (0)