Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7b566c5

Browse files
remove TABs, fix some doctests
1 parent 3238581 commit 7b566c5

File tree

4 files changed

+34
-182
lines changed

4 files changed

+34
-182
lines changed

‎2009年01月01日-SienaTutorials/Worksheet09-CombinatoricsIteratorsGenerators.rst

Lines changed: 11 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ Documentation/Resources
1515

1616
::
1717

18-
sage: sage.combinat.
18+
sage: sage.combinat. # not tested
1919

2020
::
2121

22-
sage: sage.combinat.sf.
22+
sage: sage.combinat.sf. # not tested
2323

2424
::
2525

26-
sage: sage.combinat.words.
26+
sage: sage.combinat.words. # not tested
2727

2828
- There is a chapter on *Combinatorics* in the *Reference Manual*.
2929

@@ -44,33 +44,17 @@ The Python command ``iter`` returns an iterator from an object (the object its
4444

4545
sage: it = iter([1,2,3])
4646
sage: it
47-
<listiterator object at 0x35a3950>
48-
49-
.. end of output
50-
51-
::
47+
<list_iterator object at ...>
5248

5349
sage: next(it)
5450
1
5551

56-
.. end of output
57-
58-
::
59-
6052
sage: next(it)
6153
2
6254

63-
.. end of output
64-
65-
::
66-
6755
sage: next(it)
6856
3
6957

70-
.. end of output
71-
72-
::
73-
7458
sage: next(it)
7559
Traceback (most recent call last):
7660
...
@@ -89,61 +73,29 @@ A *generator* is a function that is used to define an iterator. Instead of ``
8973
....: yield b
9074
....: a, b = b, a+b
9175

92-
93-
.. end of output
94-
95-
::
96-
9776
sage: f = fibonacci_iterator()
9877

99-
100-
.. end of output
101-
102-
::
103-
10478
sage: next(f)
10579
1
10680

107-
.. end of output
108-
109-
::
110-
11181
sage: next(f)
11282
1
11383

114-
.. end of output
115-
116-
::
117-
11884
sage: next(f)
11985
2
12086

121-
.. end of output
122-
123-
::
124-
12587
sage: next(f)
12688
3
12789

128-
.. end of output
129-
130-
::
131-
13290
sage: next(f)
13391
5
13492

135-
.. end of output
136-
137-
::
138-
13993
sage: next(f)
14094
8
14195

142-
.. end of output
143-
14496

14597
`Project Euler Problem 2 <http://projecteuler.net/index.php?section=problems&id=2>`_
146-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14799

148100
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
149101

@@ -158,22 +110,12 @@ Find the sum of all the even\-valued terms in the sequence which do not exceed f
158110

159111
sage: result = 0
160112

161-
162-
.. end of output
163-
164-
::
165-
166113
sage: for f in fibonacci_iterator():
167114
....: if f > 4000000:
168115
....: break
169116
....: if is_even(f):
170117
....: result += f
171118

172-
173-
.. end of output
174-
175-
::
176-
177119
sage: result
178120
4613732
179121

@@ -193,17 +135,9 @@ There are many objects in Sage that model sets of combinatorial objects.
193135
sage: P
194136
Standard permutations of 3
195137

196-
.. end of output
197-
198-
::
199-
200138
sage: P.cardinality()
201139
6
202140

203-
.. end of output
204-
205-
::
206-
207141
sage: P.list()
208142
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
209143

@@ -216,21 +150,13 @@ There are many objects in Sage that model sets of combinatorial objects.
216150

217151
.. end of output
218152
219-
220153
::
221154

222-
sage: time P = Permutations(7, avoiding=[2,1,4,3])
223-
sage: P
224-
Time: CPU 0.00 s, Wall: 0.00 s
155+
sage: P = Permutations(7, avoiding=[2,1,4,3]); P
225156
Standard permutations of 7 avoiding [[2, 1, 4, 3]]
226157

227-
.. end of output
228-
229-
::
230-
231-
sage: time P.cardinality()
158+
sage: P.cardinality()
232159
2761
233-
Time: CPU 4.10 s, Wall: 4.20 s
234160

235161
.. end of output
236162
@@ -309,21 +235,13 @@ There are many objects in Sage that model sets of combinatorial objects.
309235
310236
::
311237

312-
sage: W = Words("ab")
238+
sage: W = Words("ab", finite=True)
313239
sage: W
314-
Words over Ordered Alphabet ['a', 'b']
315-
316-
.. end of output
317-
318-
::
240+
Finite words over {'a', 'b'}
319241

320242
sage: W.cardinality()
321243
+Infinity
322244

323-
.. end of output
324-
325-
::
326-
327245
sage: it = iter(W)
328246
sage: for a in range(16):
329247
....: print(next(it))
@@ -352,18 +270,7 @@ There are many objects in Sage that model sets of combinatorial objects.
352270

353271
sage: P = posets()
354272
sage: P
355-
Posets
356-
357-
.. end of output
358-
359-
::
360-
361-
sage: P.cardinality()
362-
+Infinity
363-
364-
.. end of output
365-
366-
::
273+
Category of posets
367274

368275
sage: it = iter(P)
369276
sage: for a in range(10):
@@ -395,10 +302,6 @@ Sage supports several ways of creating new combinatorial classes from objects.
395302
sage: C
396303
Combinations of [1, 2, 3] of length 2
397304

398-
.. end of output
399-
400-
::
401-
402305
sage: C.list()
403306
[[1, 2], [1, 3], [2, 3]]
404307

@@ -411,10 +314,6 @@ Sage supports several ways of creating new combinatorial classes from objects.
411314
sage: S
412315
Subsets of {1, 2, 3} of size 2
413316

414-
.. end of output
415-
416-
::
417-
418317
sage: S.list()
419318
[{1, 2}, {1, 3}, {2, 3}]
420319

@@ -427,16 +326,8 @@ Sage supports several ways of creating new combinatorial classes from objects.
427326
sage: S
428327
Set partitions of ['a', 'b', 'c']
429328

430-
.. end of output
431-
432-
::
433-
434329
sage: S.list()
435-
[{{'a', 'c', 'b'}}, {{'c', 'b'}, {'a'}}, {{'c'}, {'a', 'b'}}, {{'a', 'c'}, {'b'}}, {{'c'}, {'b'}, {'a'}}]
436-
437-
.. end of output
438-
439-
::
330+
[{{'a', 'b', 'c'}}, ...]
440331

441332
sage: S.cardinality()
442333
5
@@ -449,8 +340,6 @@ Example: Vexillary involutions
449340

450341
A *vexillary involution* is a permutation that:
451342

452-
453-
454343
#. avoids the pattern 2143;
455344

456345
#. is an involution (that is, :math:`p = p^{-1}`).
@@ -464,26 +353,13 @@ We can create the set of vexillary involutions of the set {1,2,3,4} in Sage by
464353
sage: def is_involution(p):
465354
....: return p == p.inverse()
466355

467-
468-
.. end of output
469-
470-
::
471-
472356
sage: P = Permutations(4, avoiding=[2,1,4,3]).filter(is_involution)
473357
sage: P
474358
Filtered sublass of Standard permutations of 4 avoiding [[2, 1, 4, 3]]
475359

476-
.. end of output
477-
478-
::
479-
480360
sage: P.cardinality()
481361
9
482362

483-
.. end of output
484-
485-
::
486-
487363
sage: P.list()
488364
[[1, 2, 3, 4], [1, 2, 4, 3], [1, 3, 2, 4], [1, 4, 3, 2], [3, 4, 1, 2], [2, 1, 3, 4], [4, 2, 3, 1], [3, 2, 1, 4], [4, 3, 2, 1]]
489365

@@ -497,17 +373,9 @@ We can create the set of vexillary involutions of the set {1,2,3,4} in Sage by
497373
....: return P.cardinality()
498374

499375

500-
.. end of output
501-
502-
::
503-
504376
sage: SL = sloane_find([number_of_vexillary_involutions(n) for n in range(1,7)])
505377
Searching Sloane's online database...
506378

507-
.. end of output
508-
509-
::
510-
511379
sage: SL[0]
512380
[1006, 'Motzkin numbers: number of ways of drawing any number of nonintersecting chords joining n (labeled) points on a circle.', [1, 1, 2, 4, 9, 21, 51, 127, 323, 835, 2188, 5798, 15511, 41835, 113634, 310572, 853467, 2356779, 6536382, 18199284, 50852019, 142547559, 400763223, 1129760415, 3192727797, 9043402501, 25669818476, 73007772802, 208023278209, 593742784829]]
513381

@@ -604,26 +472,13 @@ At the very minimum, you should implement the following methods:
604472
....: p = Permutation(p)
605473
....: return len(p) == self._n and p.avoids([2,1,4,3]) and p == p.inverse()
606474

607-
608-
.. end of output
609-
610-
::
611-
612475
sage: V = VexillaryInvolutions(4)
613476
sage: V
614477
Vexillary involutions of 4
615478

616-
.. end of output
617-
618-
::
619-
620479
sage: [2,1,3,4] in V
621480
True
622481

623-
.. end of output
624-
625-
::
626-
627482
sage: [2,1,4,3] in V
628483
False
629484

‎2012年10月29日-CIMPA-Bobo/dynamique.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Cas particuliers:
3131
- topologique: `X` compact, `T`: continu
3232
- mesurable: `X` équipé d'une mesure `\mu` préservée par `T`:
3333

34-
`\mu (T^{-1}(A)) = \mu(A)` pour tout `A` mesurable
34+
`\mu (T^{-1}(A)) = \mu(A)` pour tout `A` mesurable
3535

3636
Questions typiques:
3737

@@ -213,7 +213,7 @@ et `T_Y`.
213213
inférieur.
214214

215215
- Induire l'application sur un cône d'angle `\pi/4` centré en - 1.
216-
- Recommencer avec `\pi/7`.
216+
- Recommencer avec `\pi/7`.
217217

218218

219219
.. TOPIC:: Exercice
@@ -224,11 +224,10 @@ et `T_Y`.
224224
.. math::
225225
226226
T(x,y)=
227-
\begin{cases}
228-
(1+a-y,x) &amp; (x,y)\in A\\
229-
(x-1,1-y) &amp; (x,y)\in B
230-
\end{cases}
231-
227+
\begin{cases}
228+
(1+a-y,x) &amp; (x,y)\in A\\
229+
(x-1,1-y) &amp; (x,y)\in B
230+
\end{cases}
232231
233232
#. Pour `a` rationnel, décrire la partition à l'étape `n`.
234233

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /