@@ -39,7 +39,7 @@ petits.
39
39
Une expression::
40
40
41
41
sage: f = cos(x)^6 + sin(x)^6 + 3 * sin(x)^2 * cos(x)^2; f
42
- sin (x)^6 + cos (x)^6 + 3*sin (x)^2*cos (x)^2
42
+ cos (x)^6 + sin (x)^6 + 3*cos (x)^2*sin (x)^2
43
43
44
44
Simplifions-la::
45
45
@@ -55,7 +55,7 @@ Une sommation définie::
55
55
1/2*sqrt(pi)/factorial(n + 1/2)
56
56
57
57
sage: pretty_print(_)
58
- <html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}\frac{\ sqrt{\pi}}{2 \, \left (n + \frac{1}{2}\right)!}</span></html>
58
+ 1/2* sqrt(pi)/factorial (n + 1/2)
59
59
60
60
Calcul de `\lim\limits_{x\rightarrow \frac{\pi}{4} }\dfrac{\cos\left(\frac{\pi}{4}-x \right)-\tan x }{1-\sin\left(\frac{\pi}{4}+x \right)} `::
61
61
@@ -88,17 +88,17 @@ des constructions algébriques plus avancées::
88
88
sage: Z2 = GF(2); Z2
89
89
Finite Field of size 2
90
90
sage: P = Z2['x']; P
91
- Univariate Polynomial Ring in x over Finite Field of size 2 (using NTL )
91
+ Univariate Polynomial Ring in x over Finite Field of size 2 (using GF2X )
92
92
sage: M = MatrixSpace(P, 3); M
93
- Full MatrixSpace of 3 by 3 dense matrices over Univariate Polynomial Ring in x over Finite Field of size 2 (using NTL )
93
+ Full MatrixSpace of 3 by 3 dense matrices over Univariate Polynomial Ring in x over Finite Field of size 2 (using GF2X )
94
94
95
95
sage: m = M.random_element(); m # random
96
96
[ x + 1 x^2 x^2]
97
97
[ x x^2 + x x + 1]
98
98
[ x^2 + 1 x^2 + x + 1 x^2]
99
99
100
100
sage: m.parent()
101
- Full MatrixSpace of 3 by 3 dense matrices over Univariate Polynomial Ring in x over Finite Field of size 2 (using NTL )
101
+ Full MatrixSpace of 3 by 3 dense matrices over Univariate Polynomial Ring in x over Finite Field of size 2 (using GF2X )
102
102
103
103
sage: m * (m-1) # random
104
104
[ x^4 + x^3 + x x^3 + x^2 x^4 + x^2]
@@ -113,7 +113,7 @@ factorisation::
113
113
114
114
sage: p = 54*x^4+36*x^3-102*x^2-72*x-12
115
115
sage: p.factor()
116
- 6*(3*x + 1)^2*(x^2 - 2)
116
+ 6*(x^2 - 2)*(3*x + 1)^2
117
117
118
118
sage: for A in [ZZ, QQ, ComplexField(16), QQ[sqrt(2)], GF(5)]:
119
119
....: print(A, ":"); print(A['x'](p).factor())
@@ -123,7 +123,7 @@ factorisation::
123
123
(54) * (x + 1/3)^2 * (x^2 - 2)
124
124
Complex Field with 16 bits of precision :
125
125
(54.00) * (x - 1.414) * (x + 0.3333)^2 * (x + 1.414)
126
- Number Field in sqrt2 with defining polynomial x^2 - 2 :
126
+ Number Field in sqrt2 with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095? :
127
127
(54) * (x - sqrt2) * (x + sqrt2) * (x + 1/3)^2
128
128
Finite Field of size 5 :
129
129
(4) * (x + 2)^2 * (x^2 + 3)
@@ -265,7 +265,7 @@ Voire faire des calculs avec::
265
265
On veut maintenant manipuler `A ` comme un morphisme sur `V `::
266
266
267
267
sage: phi = End(V)(A); phi
268
- Free module morphism defined by the matrix
268
+ Vector space morphism represented by the matrix:
269
269
[5 5 4 3]
270
270
[0 3 3 4]
271
271
[0 1 5 4]
@@ -288,7 +288,7 @@ On veut maintenant manipuler `A` comme un morphisme sur `V`::
288
288
::
289
289
290
290
sage: phi^4 + 5*phi^3 + 6*phi + 2
291
- Free module morphism defined by the matrix
291
+ Vector space morphism represented by the matrix:
292
292
[0 0 0 0]
293
293
[0 0 0 0]
294
294
[0 0 0 0]
@@ -307,7 +307,7 @@ On veut maintenant manipuler `A` comme un morphisme sur `V`::
307
307
True
308
308
309
309
sage: phi.restrict(E[2])
310
- Free module morphism defined by the matrix
310
+ Vector space morphism represented by the matrix:
311
311
[2 0]
312
312
[0 2]
313
313
Domain: Vector space of degree 4 and dimension 2 over Finite Field of ...
@@ -349,8 +349,8 @@ cinq cartes à jouer::
349
349
350
350
sage: Symboles = Set(["Coeur", "Carreau", "Pique", "Trefle"])
351
351
sage: Valeurs = Set([2, 3, 4, 5, 6, 7, 8, 9, 10, "Valet", "Dame", "Roi", "As"])
352
- sage: Cartes = CartesianProduct( Valeurs, Symboles).map(tuple )
353
- sage: Mains = Subsets(Cartes, 5)
352
+ sage: Cartes = cartesian_product([ Valeurs, Symboles] )
353
+ sage: Mains = Subsets(Cartes, 5)
354
354
sage: Mains.cardinality()
355
355
2598960
356
356
sage: Mains.random_element() # random
@@ -391,11 +391,11 @@ Combinatoire algébrique
391
391
Et pour faire joli, un système de racine affine et un groupe de Weyl::
392
392
393
393
sage: L = RootSystem(['A',2,1]).weight_space()
394
- sage: L.plot(size=[[-1..1],[-1..1]], alcovewalks=[[0,2,0,1,2,1,2,0,2,1]] )
394
+ sage: L.plot()
395
395
396
396
sage: W = WeylGroup(["B", 3])
397
- sage: W.cayley_graph(side = "left").plot3d(color_by_label = True)
398
-
397
+ sage: W.cayley_graph(side = "left").plot3d(color_by_label= True)
398
+ Graphics3d Object
399
399
400
400
Graphes
401
401
=======
@@ -407,21 +407,21 @@ graphes::
407
407
sage: g.show()
408
408
409
409
sage: c = g.hamiltonian_cycle()
410
- sage: g.show(edge_colors = {"red": c.edges()} )
410
+ sage: g.show(edge_colors= {"red": c.edges(sort=False)} )
411
411
412
412
Grâce à GAP et à (un port de) Nauty, on peut étudier de près les
413
413
questions de symétries et d'isomorphisme dans les graphes. Voici tous
414
414
les graphes simples sur cinq sommets avec moins de quatre arêtes::
415
415
416
- sage: show(graphs(5, lambda G: G.size() <= 4))
416
+ sage: show(next( graphs(5, lambda G: G.size() <= 4) ))
417
417
418
418
Le groupe de symétries (automorphismes) du graphe de Petersen::
419
419
420
420
sage: petersen = graphs.PetersenGraph()
421
421
sage: petersen.show()
422
422
423
423
sage: group = petersen.automorphism_group(); group
424
- Permutation Group with generators [(3,7)(4,5)(8,9), (2,6)(3,8)(4,5)(7,9), (1,4,5)(2,3,8,6,9,7), (1,10)(2,4,6,5)(3,9,8,7) ]
424
+ Permutation Group with generators [(3,7)(4,5)(8,9), (2,6)(3,8)(4,5)(7,9), ... ]
425
425
426
426
Et quelques-unes de ses propriétés::
427
427
@@ -513,7 +513,7 @@ Ce qui en Sage donne::
513
513
sage: LP = MixedIntegerLinearProgram(maximization=True)
514
514
sage: b = LP.new_variable()
515
515
sage: LP.set_objective(sum([b[v] for v in petersen]))
516
- sage: for (u,v) in petersen.edges(labels=None): # For any edge, we define a constraint
516
+ sage: for (u,v) in petersen.edges(labels=None, sort=False ): # For any edge, we define a constraint
517
517
....: LP.add_constraint(b[u]+b[v],max=1)
518
518
sage: LP.set_binary(b)
519
519
@@ -526,13 +526,13 @@ On trouve alors un indépendant de taille quatre::
526
526
sage: print(b_sol)
527
527
{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}
528
528
529
- sage: I = [ v for v in petersen.vertices() if b_sol[v] ]; I
529
+ sage: I = [v for v in petersen.vertices(sort=False ) if b_sol[v]]; I
530
530
[1, 4, 7, 8]
531
531
sage: petersen.show(vertex_colors = {'red' : I})
532
532
533
533
Pour finir, on manipule l'ensemble de tous les points entiers d'un polytope::
534
534
535
- sage: A = random_matrix(ZZ,3,6 ,x=7)
535
+ sage: A = random_matrix(ZZ,6,3 ,x=7)
536
536
sage: L = LatticePolytope(A)
537
537
sage: L.plot3d()
538
538
@@ -562,7 +562,7 @@ Toujours dans l'idée de modéliser les mathématiques au plus près, Sage
562
562
a des informations sur la *structure mathématique * de `K `::
563
563
564
564
sage: K.category()
565
- Category of finite fields
565
+ Join of Category of finite enumerated fields and Category of subquotients of monoids and Category of quotients of semigroups
566
566
567
567
Voilà ce qu'il peut en déduire:
568
568
@@ -594,7 +594,7 @@ En quoi est-ce utile?
594
594
595
595
2. Partage de code générique::
596
596
597
- sage: K.multiplication_table(names = 'elements')
597
+ sage: K.multiplication_table(names= 'elements')
598
598
* 0 1 2 3 4 5 6
599
599
+--------------
600
600
0| 0 0 0 0 0 0 0
@@ -615,47 +615,15 @@ En quoi est-ce utile?
615
615
....: print(cls)
616
616
<class 'sage.rings.finite_rings.finite_field_prime_modn.FiniteField_prime_modn_with_category'>
617
617
...
618
- <class 'sage.categories.finite_fields.FiniteFields.parent_class'>
619
- <class 'sage.categories.fields.Fields.parent_class'>
620
- <class 'sage.categories.euclidean_domains.EuclideanDomains.parent_class'>
621
- <class 'sage.categories.principal_ideal_domains.PrincipalIdealDomains.parent_class'>
622
- <class 'sage.categories.unique_factorization_domains.UniqueFactorizationDomains.parent_class'>
623
- <class 'sage.categories.gcd_domains.GcdDomains.parent_class'>
624
- ...
625
- <class 'sage.categories.magmas.Magmas.parent_class'>
626
- ...
627
- <class 'sage.categories.finite_sets.FiniteSets.parent_class'>
628
- ...
629
- <type 'object'>
618
+ <class 'object'>
630
619
631
620
632
621
3. Partage de tests génériques::
633
622
634
623
sage: TestSuite(K).run(verbose=True)
635
624
running ._test_additive_associativity() . . . pass
636
- running ._test_an_element() . . . pass
637
- running ._test_associativity() . . . pass
638
- running ._test_category() . . . pass
639
- running ._test_distributivity() . . . pass
640
- running ._test_elements() . . .
641
- Running the test suite of self.an_element()
642
- running ._test_category() . . . pass
643
- running ._test_eq() . . . pass
644
- running ._test_not_implemented_methods() . . . pass
645
- running ._test_pickling() . . . pass
646
- pass
647
- running ._test_elements_eq() . . . pass
648
- running ._test_enumerated_set_contains() . . . pass
649
- running ._test_enumerated_set_iter_cardinality() . . . pass
650
- running ._test_enumerated_set_iter_list() . . . pass
651
- running ._test_eq() . . . pass
652
- running ._test_len() . . . pass
653
- running ._test_not_implemented_methods() . . . pass
654
- running ._test_one() . . . pass
655
- running ._test_pickling() . . . pass
656
- running ._test_prod() . . . pass
657
- running ._test_some_elements() . . . pass
658
- running ._test_zero() . . . pass
625
+ ...
626
+ running ._test_zero_divisors() . . . pass
659
627
660
628
661
629
A demonstration of Sage + GAP4 + GAP3 + Chevie + Semigroupe
0 commit comments