passagemath-symbolics 10.6.43__cp314-cp314t-musllinux_1_2_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-symbolics might be problematic. Click here for more details.
- passagemath_symbolics/__init__.py +3 -0
- passagemath_symbolics-10.6.43.dist-info/METADATA +187 -0
- passagemath_symbolics-10.6.43.dist-info/RECORD +171 -0
- passagemath_symbolics-10.6.43.dist-info/WHEEL +5 -0
- passagemath_symbolics-10.6.43.dist-info/top_level.txt +3 -0
- sage/all__sagemath_symbolics.py +17 -0
- sage/calculus/all.py +14 -0
- sage/calculus/calculus.py +2826 -0
- sage/calculus/desolvers.py +1866 -0
- sage/calculus/predefined.py +51 -0
- sage/calculus/tests.py +225 -0
- sage/calculus/var.cpython-314t-x86_64-linux-musl.so +0 -0
- sage/calculus/var.pyx +401 -0
- sage/dynamics/all__sagemath_symbolics.py +6 -0
- sage/dynamics/complex_dynamics/all.py +5 -0
- sage/dynamics/complex_dynamics/mandel_julia.py +765 -0
- sage/dynamics/complex_dynamics/mandel_julia_helper.cpython-314t-x86_64-linux-musl.so +0 -0
- sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +1035 -0
- sage/ext/all__sagemath_symbolics.py +1 -0
- sage/ext_data/kenzo/CP2.txt +45 -0
- sage/ext_data/kenzo/CP3.txt +349 -0
- sage/ext_data/kenzo/CP4.txt +4774 -0
- sage/ext_data/kenzo/README.txt +49 -0
- sage/ext_data/kenzo/S4.txt +20 -0
- sage/ext_data/magma/latex/latex.m +1021 -0
- sage/ext_data/magma/latex/latex.spec +1 -0
- sage/ext_data/magma/sage/basic.m +356 -0
- sage/ext_data/magma/sage/sage.spec +1 -0
- sage/ext_data/magma/spec +9 -0
- sage/geometry/all__sagemath_symbolics.py +8 -0
- sage/geometry/hyperbolic_space/all.py +5 -0
- sage/geometry/hyperbolic_space/hyperbolic_coercion.py +743 -0
- sage/geometry/hyperbolic_space/hyperbolic_constants.py +5 -0
- sage/geometry/hyperbolic_space/hyperbolic_geodesic.py +2409 -0
- sage/geometry/hyperbolic_space/hyperbolic_interface.py +206 -0
- sage/geometry/hyperbolic_space/hyperbolic_isometry.py +1082 -0
- sage/geometry/hyperbolic_space/hyperbolic_model.py +1502 -0
- sage/geometry/hyperbolic_space/hyperbolic_point.py +621 -0
- sage/geometry/riemannian_manifolds/all.py +7 -0
- sage/geometry/riemannian_manifolds/parametrized_surface3d.py +1632 -0
- sage/geometry/riemannian_manifolds/surface3d_generators.py +461 -0
- sage/interfaces/all__sagemath_symbolics.py +1 -0
- sage/interfaces/magma.py +3017 -0
- sage/interfaces/magma_free.py +92 -0
- sage/interfaces/maple.py +1397 -0
- sage/interfaces/mathematica.py +1345 -0
- sage/interfaces/mathics.py +1312 -0
- sage/interfaces/sympy.py +1398 -0
- sage/interfaces/sympy_wrapper.py +197 -0
- sage/interfaces/tides.py +938 -0
- sage/libs/all__sagemath_symbolics.py +6 -0
- sage/manifolds/all.py +7 -0
- sage/manifolds/calculus_method.py +555 -0
- sage/manifolds/catalog.py +437 -0
- sage/manifolds/chart.py +4019 -0
- sage/manifolds/chart_func.py +3419 -0
- sage/manifolds/continuous_map.py +2183 -0
- sage/manifolds/continuous_map_image.py +155 -0
- sage/manifolds/differentiable/affine_connection.py +2475 -0
- sage/manifolds/differentiable/all.py +1 -0
- sage/manifolds/differentiable/automorphismfield.py +1383 -0
- sage/manifolds/differentiable/automorphismfield_group.py +604 -0
- sage/manifolds/differentiable/bundle_connection.py +1445 -0
- sage/manifolds/differentiable/characteristic_cohomology_class.py +1840 -0
- sage/manifolds/differentiable/chart.py +1241 -0
- sage/manifolds/differentiable/curve.py +1028 -0
- sage/manifolds/differentiable/de_rham_cohomology.py +541 -0
- sage/manifolds/differentiable/degenerate.py +559 -0
- sage/manifolds/differentiable/degenerate_submanifold.py +1671 -0
- sage/manifolds/differentiable/diff_form.py +1658 -0
- sage/manifolds/differentiable/diff_form_module.py +1062 -0
- sage/manifolds/differentiable/diff_map.py +1315 -0
- sage/manifolds/differentiable/differentiable_submanifold.py +291 -0
- sage/manifolds/differentiable/examples/all.py +1 -0
- sage/manifolds/differentiable/examples/euclidean.py +2517 -0
- sage/manifolds/differentiable/examples/real_line.py +897 -0
- sage/manifolds/differentiable/examples/sphere.py +1186 -0
- sage/manifolds/differentiable/examples/symplectic_space.py +187 -0
- sage/manifolds/differentiable/examples/symplectic_space_test.py +40 -0
- sage/manifolds/differentiable/integrated_curve.py +4035 -0
- sage/manifolds/differentiable/levi_civita_connection.py +841 -0
- sage/manifolds/differentiable/manifold.py +4254 -0
- sage/manifolds/differentiable/manifold_homset.py +1826 -0
- sage/manifolds/differentiable/metric.py +3032 -0
- sage/manifolds/differentiable/mixed_form.py +1507 -0
- sage/manifolds/differentiable/mixed_form_algebra.py +559 -0
- sage/manifolds/differentiable/multivector_module.py +800 -0
- sage/manifolds/differentiable/multivectorfield.py +1520 -0
- sage/manifolds/differentiable/poisson_tensor.py +268 -0
- sage/manifolds/differentiable/pseudo_riemannian.py +755 -0
- sage/manifolds/differentiable/pseudo_riemannian_submanifold.py +1839 -0
- sage/manifolds/differentiable/scalarfield.py +1343 -0
- sage/manifolds/differentiable/scalarfield_algebra.py +472 -0
- sage/manifolds/differentiable/symplectic_form.py +910 -0
- sage/manifolds/differentiable/symplectic_form_test.py +220 -0
- sage/manifolds/differentiable/tangent_space.py +412 -0
- sage/manifolds/differentiable/tangent_vector.py +616 -0
- sage/manifolds/differentiable/tensorfield.py +4665 -0
- sage/manifolds/differentiable/tensorfield_module.py +963 -0
- sage/manifolds/differentiable/tensorfield_paral.py +2450 -0
- sage/manifolds/differentiable/tensorfield_paral_test.py +16 -0
- sage/manifolds/differentiable/vector_bundle.py +1728 -0
- sage/manifolds/differentiable/vectorfield.py +1717 -0
- sage/manifolds/differentiable/vectorfield_module.py +2445 -0
- sage/manifolds/differentiable/vectorframe.py +1832 -0
- sage/manifolds/family.py +270 -0
- sage/manifolds/local_frame.py +1490 -0
- sage/manifolds/manifold.py +3090 -0
- sage/manifolds/manifold_homset.py +452 -0
- sage/manifolds/operators.py +359 -0
- sage/manifolds/point.py +994 -0
- sage/manifolds/scalarfield.py +3718 -0
- sage/manifolds/scalarfield_algebra.py +629 -0
- sage/manifolds/section.py +3111 -0
- sage/manifolds/section_module.py +831 -0
- sage/manifolds/structure.py +229 -0
- sage/manifolds/subset.py +2764 -0
- sage/manifolds/subsets/all.py +1 -0
- sage/manifolds/subsets/closure.py +131 -0
- sage/manifolds/subsets/pullback.py +885 -0
- sage/manifolds/topological_submanifold.py +891 -0
- sage/manifolds/trivialization.py +733 -0
- sage/manifolds/utilities.py +1348 -0
- sage/manifolds/vector_bundle.py +1342 -0
- sage/manifolds/vector_bundle_fiber.py +332 -0
- sage/manifolds/vector_bundle_fiber_element.py +111 -0
- sage/matrix/all__sagemath_symbolics.py +1 -0
- sage/matrix/matrix_symbolic_dense.cpython-314t-x86_64-linux-musl.so +0 -0
- sage/matrix/matrix_symbolic_dense.pxd +6 -0
- sage/matrix/matrix_symbolic_dense.pyx +1022 -0
- sage/matrix/matrix_symbolic_sparse.cpython-314t-x86_64-linux-musl.so +0 -0
- sage/matrix/matrix_symbolic_sparse.pxd +6 -0
- sage/matrix/matrix_symbolic_sparse.pyx +1029 -0
- sage/modules/all__sagemath_symbolics.py +1 -0
- sage/modules/vector_callable_symbolic_dense.py +105 -0
- sage/modules/vector_symbolic_dense.py +116 -0
- sage/modules/vector_symbolic_sparse.py +118 -0
- sage/rings/all__sagemath_symbolics.py +4 -0
- sage/rings/asymptotic/all.py +6 -0
- sage/rings/asymptotic/asymptotic_expansion_generators.py +1485 -0
- sage/rings/asymptotic/asymptotic_ring.py +4858 -0
- sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py +4153 -0
- sage/rings/asymptotic/growth_group.py +5373 -0
- sage/rings/asymptotic/growth_group_cartesian.py +1400 -0
- sage/rings/asymptotic/term_monoid.py +5237 -0
- sage/rings/function_field/all__sagemath_symbolics.py +2 -0
- sage/rings/polynomial/all__sagemath_symbolics.py +1 -0
- sage/symbolic/all.py +15 -0
- sage/symbolic/assumptions.py +985 -0
- sage/symbolic/benchmark.py +93 -0
- sage/symbolic/callable.py +459 -0
- sage/symbolic/complexity_measures.py +35 -0
- sage/symbolic/constants.py +1287 -0
- sage/symbolic/expression_conversion_algebraic.py +310 -0
- sage/symbolic/expression_conversion_sympy.py +317 -0
- sage/symbolic/expression_conversions.py +1713 -0
- sage/symbolic/function_factory.py +355 -0
- sage/symbolic/integration/all.py +1 -0
- sage/symbolic/integration/external.py +270 -0
- sage/symbolic/integration/integral.py +1115 -0
- sage/symbolic/maxima_wrapper.py +162 -0
- sage/symbolic/operators.py +267 -0
- sage/symbolic/random_tests.py +462 -0
- sage/symbolic/relation.py +1907 -0
- sage/symbolic/ring.cpython-314t-x86_64-linux-musl.so +0 -0
- sage/symbolic/ring.pxd +5 -0
- sage/symbolic/ring.pyx +1396 -0
- sage/symbolic/subring.py +1025 -0
- sage/symbolic/symengine.py +19 -0
- sage/symbolic/tests.py +40 -0
- sage/symbolic/units.py +1470 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
latex.m
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
// -*- magma -*-
|
|
2
|
+
|
|
3
|
+
function PreparseElts(R)
|
|
4
|
+
if Type(R) eq RngInt then
|
|
5
|
+
return false;
|
|
6
|
+
end if;
|
|
7
|
+
return true;
|
|
8
|
+
end function;
|
|
9
|
+
|
|
10
|
+
intrinsic Sage(X::.) -> MonStgElt, BoolElt
|
|
11
|
+
{Default way to convert a Magma object to Sage if we have not
|
|
12
|
+
written anything better.}
|
|
13
|
+
return Sprintf("%o", X), true;
|
|
14
|
+
end intrinsic;
|
|
15
|
+
|
|
16
|
+
intrinsic Sage(X::SeqEnum) -> MonStgElt, BoolElt
|
|
17
|
+
{Convert an enumerated sequence to Sage.}
|
|
18
|
+
Y := [Sage(z) : z in X];
|
|
19
|
+
return Sprintf("%o", Y), true;
|
|
20
|
+
end intrinsic;
|
|
21
|
+
|
|
22
|
+
intrinsic Sage(X::Tup) -> MonStgElt, BoolElt
|
|
23
|
+
{Return a Magma Tuple as a Sage Tuple}
|
|
24
|
+
if #X eq 0 then
|
|
25
|
+
return "()", true;
|
|
26
|
+
elif #X eq 1 then
|
|
27
|
+
return Sprintf("(%o,)",Sage(X[1])),true;
|
|
28
|
+
end if;
|
|
29
|
+
r := Sprintf("%o",[Sage(x) : x in X]);
|
|
30
|
+
return "(" cat Substring(r,2,#r-2) cat ")",true;
|
|
31
|
+
end intrinsic;
|
|
32
|
+
|
|
33
|
+
intrinsic Sage(X::SetEnum) -> MonStgElt, BoolElt
|
|
34
|
+
{Convert an enumerated set to Sage.}
|
|
35
|
+
Y := [Sage(z) : z in X];
|
|
36
|
+
return Sprintf("Set(%o)", Y), true;
|
|
37
|
+
end intrinsic;
|
|
38
|
+
|
|
39
|
+
intrinsic Sage(X::SetIndx) -> MonStgElt, BoolElt
|
|
40
|
+
{Convert an indexed set to Sage.
|
|
41
|
+
WARNING: Sage does not have an analogue of indexed sets (yet!),
|
|
42
|
+
so we just return a Python list.}
|
|
43
|
+
Y := [Sage(z) : z in X];
|
|
44
|
+
return Sprintf("%o", Y), true;
|
|
45
|
+
end intrinsic;
|
|
46
|
+
|
|
47
|
+
intrinsic Sage(X::SetMulti) -> MonStgElt, BoolElt
|
|
48
|
+
{Convert a multiset to Sage.
|
|
49
|
+
WARNING: Sage does not have an analogue of multisets yet, so we return a Python list.}
|
|
50
|
+
Y := [Sage(z) : z in X];
|
|
51
|
+
return Sprintf("%o", Y), true;
|
|
52
|
+
end intrinsic;
|
|
53
|
+
|
|
54
|
+
intrinsic Sage(X::RngInt) -> MonStgElt, BoolElt
|
|
55
|
+
{Conver the ring of integers to Sage.}
|
|
56
|
+
return "ZZ", false;
|
|
57
|
+
end intrinsic;
|
|
58
|
+
|
|
59
|
+
intrinsic Sage(X::FldRat) -> MonStgElt, BoolElt
|
|
60
|
+
{}
|
|
61
|
+
return "QQ", false;
|
|
62
|
+
end intrinsic;
|
|
63
|
+
|
|
64
|
+
intrinsic Sage(X::RngIntElt) -> MonStgElt, BoolElt
|
|
65
|
+
{}
|
|
66
|
+
return Sprintf("Integer('%h')", X), false;
|
|
67
|
+
end intrinsic;
|
|
68
|
+
|
|
69
|
+
/* Matrices */
|
|
70
|
+
|
|
71
|
+
function convert_matrix(X, preparse_entries)
|
|
72
|
+
if preparse_entries then
|
|
73
|
+
return Sprintf("matrix(%o, %o, %o, %o)", Sage(BaseRing(X)),
|
|
74
|
+
Nrows(X), Ncols(X), [Sage(y) : y in Eltseq(X)]);
|
|
75
|
+
else
|
|
76
|
+
return Sprintf("matrix(%o, %o, %o, %o)", Sage(BaseRing(X)),
|
|
77
|
+
Nrows(X), Ncols(X), Eltseq(X));
|
|
78
|
+
end if;
|
|
79
|
+
end function;
|
|
80
|
+
|
|
81
|
+
intrinsic Sage(X::AlgMatElt) -> MonStgElt, BoolElt
|
|
82
|
+
{}
|
|
83
|
+
pp := PreparseElts(BaseRing(X));
|
|
84
|
+
return convert_matrix(X, pp), pp;
|
|
85
|
+
end intrinsic;
|
|
86
|
+
|
|
87
|
+
intrinsic Sage(X::ModMatRngElt) -> MonStgElt, BoolElt
|
|
88
|
+
{}
|
|
89
|
+
pp := PreparseElts(BaseRing(X));
|
|
90
|
+
return convert_matrix(X, pp), pp;
|
|
91
|
+
end intrinsic;
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
intrinsic SageCreateWithNames(X::., names::.) -> .
|
|
95
|
+
{Assign the given names to the object X, then return X.}
|
|
96
|
+
AssignNames(~X, names);
|
|
97
|
+
return X;
|
|
98
|
+
end intrinsic;
|
|
99
|
+
|
|
100
|
+
/* Finite fields */
|
|
101
|
+
|
|
102
|
+
intrinsic Sage(X::FldFin) -> MonStgElt, BoolElt
|
|
103
|
+
{}
|
|
104
|
+
if IsPrimeField(X) then
|
|
105
|
+
return Sprintf("GF(%o)", Characteristic(X)), false;
|
|
106
|
+
else
|
|
107
|
+
return Sprintf("GF(%o, '%o'.replace('$.', 'x').replace('.', ''), modulus=%o)", #X, X.1, Sage(DefiningPolynomial(X))), false;
|
|
108
|
+
end if;
|
|
109
|
+
end intrinsic;
|
|
110
|
+
|
|
111
|
+
intrinsic Sage(X::FldFinElt) -> MonStgElt, BoolElt
|
|
112
|
+
{}
|
|
113
|
+
P := Parent(X);
|
|
114
|
+
if IsPrimeField(P) then
|
|
115
|
+
return Sprintf("%o(%o)", Sage(P), Integers()!X), false;
|
|
116
|
+
else
|
|
117
|
+
return Sprintf("%o(%o)", Sage(Parent(X)), Sage(Polynomial(Eltseq(X)))), false;
|
|
118
|
+
end if;
|
|
119
|
+
end intrinsic;
|
|
120
|
+
|
|
121
|
+
/* Finite quotients of ZZ */
|
|
122
|
+
|
|
123
|
+
intrinsic Sage(X::RngIntRes) -> MonStgElt, BoolElt
|
|
124
|
+
{}
|
|
125
|
+
return Sprintf("Zmod(%o)", Characteristic(X)), false;
|
|
126
|
+
end intrinsic;
|
|
127
|
+
|
|
128
|
+
/* Approximate real and complex fields */
|
|
129
|
+
|
|
130
|
+
intrinsic Sage(X::FldRe) -> MonStgElt, BoolElt
|
|
131
|
+
{}
|
|
132
|
+
return Sprintf("RealField(%o)", Precision(X : Bits := true)), false;
|
|
133
|
+
end intrinsic;
|
|
134
|
+
|
|
135
|
+
intrinsic Sage(X::FldCom) -> MonStgElt, BoolElt
|
|
136
|
+
{}
|
|
137
|
+
return Sprintf("ComplexField(%o)", Precision(X : Bits := true)), false;
|
|
138
|
+
end intrinsic;
|
|
139
|
+
|
|
140
|
+
intrinsic Sage(X::FldReElt) -> MonStgElt, BoolElt
|
|
141
|
+
{}
|
|
142
|
+
return Sprintf("%o(%o)", Sage(Parent(X)), X), true;
|
|
143
|
+
end intrinsic;
|
|
144
|
+
|
|
145
|
+
intrinsic Sage(X::FldComElt) -> MonStgElt, BoolElt
|
|
146
|
+
{}
|
|
147
|
+
return Sprintf("%o([%o, %o])", Sage(Parent(X)), Sage(Real(X)), Sage(Imaginary(X))), true;
|
|
148
|
+
end intrinsic;
|
|
149
|
+
|
|
150
|
+
/* p-adic rings and fields */
|
|
151
|
+
|
|
152
|
+
intrinsic Sage(X::RngPad) -> MonStgElt, BoolElt
|
|
153
|
+
{p-adic rings, either free precision model or exact model}
|
|
154
|
+
prec := Precision(X);
|
|
155
|
+
if Type(prec) eq Infty then
|
|
156
|
+
return Sprintf("Zp(%o, %o, 'relaxed')", Sage(Prime(X)), Sage(prec)), false;
|
|
157
|
+
else
|
|
158
|
+
return Sprintf("Zp(%o, %o, 'capped-abs')", Sage(Prime(X)), Sage(prec)), false;
|
|
159
|
+
end if;
|
|
160
|
+
end intrinsic;
|
|
161
|
+
|
|
162
|
+
intrinsic Sage(X::FldPad) -> MonStgElt, BoolElt
|
|
163
|
+
{p-adic fields, either free precision model or exact model}
|
|
164
|
+
prec := Precision(X);
|
|
165
|
+
if Type(prec) eq Infty then
|
|
166
|
+
return Sprintf("Qp(%o, %o, 'relaxed')", Sage(Prime(X)), Sage(prec)), false;
|
|
167
|
+
else
|
|
168
|
+
return Sprintf("Qp(%o, %o, 'capped-rel')", Sage(Prime(X)), Sage(prec)), false;
|
|
169
|
+
end if;
|
|
170
|
+
end intrinsic;
|
|
171
|
+
|
|
172
|
+
intrinsic Sage(X::RngPadRes) -> MonStgElt, BoolElt
|
|
173
|
+
{fixed precision model}
|
|
174
|
+
return Sprintf("Zp(%o, %o, 'fixed-mod')", Sage(Prime(X)), Sage(Precision(X))), false;
|
|
175
|
+
end intrinsic;
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
/* Polynomials */
|
|
179
|
+
|
|
180
|
+
intrinsic SageNamesHelper(X::.) -> MonStgElt
|
|
181
|
+
{}
|
|
182
|
+
/* XXX */
|
|
183
|
+
i := NumberOfNames(X);
|
|
184
|
+
if "$" in Sprint(X.i) then
|
|
185
|
+
/* unnamed variables */
|
|
186
|
+
return "(" * (&* [ Sprintf("'x%o', ", j) : j in [ 1..i ] ]) * ")";
|
|
187
|
+
else
|
|
188
|
+
/* named variables */
|
|
189
|
+
return "(" * (&* [ Sprintf("'%o'.replace('.', ''), ", X.j) : j in [ 1..i ] ]) * ")";
|
|
190
|
+
|
|
191
|
+
end if;
|
|
192
|
+
end intrinsic;
|
|
193
|
+
|
|
194
|
+
intrinsic Sage(X::RngUPol) -> MonStgElt, BoolElt
|
|
195
|
+
{}
|
|
196
|
+
txt := "PolynomialRing(%o, %o)";
|
|
197
|
+
return Sprintf(txt, Sage(BaseRing(X)), SageNamesHelper(X)), false;
|
|
198
|
+
end intrinsic;
|
|
199
|
+
|
|
200
|
+
intrinsic Sage(X::RngUPolElt) -> MonStgElt, BoolElt
|
|
201
|
+
{}
|
|
202
|
+
pp := PreparseElts(BaseRing(X));
|
|
203
|
+
return Sprintf("%o(%o)", Sage(Parent(X)), Sage(Coefficients(X))), pp;
|
|
204
|
+
end intrinsic;
|
|
205
|
+
|
|
206
|
+
intrinsic Sage(X::RngMPol) -> MonStgElt, BoolElt
|
|
207
|
+
{}
|
|
208
|
+
txt := "PolynomialRing(%o, %o)";
|
|
209
|
+
return Sprintf(txt, Sage(BaseRing(X)), SageNamesHelper(X)), false;
|
|
210
|
+
end intrinsic;
|
|
211
|
+
|
|
212
|
+
intrinsic Sage(X::RngMPolElt) -> MonStgElt, BoolElt
|
|
213
|
+
{}
|
|
214
|
+
Y := Sage([ < <e : e in Exponents(t)>, Coefficients(t)[1]> : t in Terms(X)]);
|
|
215
|
+
R := Sage(Parent(X));
|
|
216
|
+
return Sprintf("%o(dict(%o))",R,Y),true;
|
|
217
|
+
end intrinsic;
|
|
218
|
+
|
|
219
|
+
/* Number fields */
|
|
220
|
+
|
|
221
|
+
intrinsic Sage(K::FldNum) -> MonStgElt, BoolElt
|
|
222
|
+
{}
|
|
223
|
+
gens := GeneratorsSequence(K);
|
|
224
|
+
if "$" in Sprint(gens[1]) then
|
|
225
|
+
/* unnamed variables */
|
|
226
|
+
names := "(" * (&* [ Sprintf("'a%o', ", j) : j in [ 1..#gens ] ]) * ")";
|
|
227
|
+
else
|
|
228
|
+
/* named variables */
|
|
229
|
+
names := "(" * (&* [ Sprintf("'%o'.replace('.', ''), ", a) : a in gens]) * ")";
|
|
230
|
+
end if;
|
|
231
|
+
polynomials := DefiningPolynomial(K);
|
|
232
|
+
return Sprintf("NumberField(%o, %o)", Sage(polynomials), names), false;
|
|
233
|
+
end intrinsic;
|
|
234
|
+
|
|
235
|
+
intrinsic Sage(A::FldNumElt) -> MonStgElt, BoolElt
|
|
236
|
+
{Converts a number field element to Sage.
|
|
237
|
+
Only number fields generated by a single element over
|
|
238
|
+
the base field are supported.
|
|
239
|
+
It seems that FldNum is always represented by
|
|
240
|
+
a power basis. Just in case, this function
|
|
241
|
+
checks whether this is true.}
|
|
242
|
+
K := Parent(A);
|
|
243
|
+
gens := GeneratorsSequence(K);
|
|
244
|
+
if #gens ne 1 then return Sprint(A), true; end if;
|
|
245
|
+
gen := gens[1];
|
|
246
|
+
deg := Degree(K);
|
|
247
|
+
bas := Basis(K);
|
|
248
|
+
for a in [0..deg-1] do
|
|
249
|
+
if gen^a ne bas[a+1] then
|
|
250
|
+
return Sprint(A), true;
|
|
251
|
+
end if; end for;
|
|
252
|
+
seq := Eltseq(A);
|
|
253
|
+
return Sprintf("%o(%o)", Sage(K), Sage(seq)), true;
|
|
254
|
+
end intrinsic;
|
|
255
|
+
|
|
256
|
+
intrinsic Sage(O::RngOrd) -> MonStgElt, BoolElt
|
|
257
|
+
{Converts an order of a number field to sage.}
|
|
258
|
+
K:=NumberField(O);
|
|
259
|
+
if IsMaximal(O) then
|
|
260
|
+
return Sprintf("%o.maximal_order()",Sage(K)), true;
|
|
261
|
+
end if;
|
|
262
|
+
B:=Basis(O);
|
|
263
|
+
seq := [K!B[i] : i in [1..#B]];
|
|
264
|
+
return Sprintf("%o.order(%o)", Sage(K),Sage(seq)), true;
|
|
265
|
+
end intrinsic;
|
|
266
|
+
|
|
267
|
+
intrinsic Sage(I::RngOrdIdl) -> MonStgElt, BoolElt
|
|
268
|
+
{Converts an ideal of a number field to sage.}
|
|
269
|
+
O:=Order(I);
|
|
270
|
+
K:=NumberField(O);
|
|
271
|
+
gens:=Generators(I);
|
|
272
|
+
seq := [K!gens[i] : i in [1..#gens]];
|
|
273
|
+
return Sprintf("%o.ideal(%o)", Sage(K),Sage(seq)), true;
|
|
274
|
+
end intrinsic;
|
|
275
|
+
|
|
276
|
+
/* Symmetric functions */
|
|
277
|
+
|
|
278
|
+
intrinsic Sage(X::AlgSym) -> MonStgElt, BoolElt
|
|
279
|
+
{}
|
|
280
|
+
if HasSchurBasis(X) then
|
|
281
|
+
return Sprintf("SymmetricFunctions(%o).s()", Sage(BaseRing(X))), false;
|
|
282
|
+
elif HasHomogeneousBasis(X) then
|
|
283
|
+
return Sprintf("SymmetricFunctions(%o).h()", Sage(BaseRing(X))), false;
|
|
284
|
+
elif HasElementaryBasis(X) then
|
|
285
|
+
return Sprintf("SymmetricFunctions(%o).e()", Sage(BaseRing(X))), false;
|
|
286
|
+
elif HasPowerSumBasis(X) then
|
|
287
|
+
return Sprintf("SymmetricFunctions(%o).p()", Sage(BaseRing(X))), false;
|
|
288
|
+
elif HasMonomialBasis(X) then
|
|
289
|
+
return Sprintf("SymmetricFunctions(%o).m()", Sage(BaseRing(X))), false;
|
|
290
|
+
end if;
|
|
291
|
+
end intrinsic;
|
|
292
|
+
|
|
293
|
+
intrinsic Sage(X::AlgSymElt) -> MonStgElt, BoolElt
|
|
294
|
+
{}
|
|
295
|
+
PA := Parent(X);
|
|
296
|
+
SF := Sage(PA);
|
|
297
|
+
BR := Sage(BaseRing(PA));
|
|
298
|
+
parts, coeffs := Support(X);
|
|
299
|
+
dict := (&* [ Sprintf("Partition(%o):%o(%o),", Sage(parts[i]), BR, Sage(coeffs[i])) : i in [1..#parts] ]);
|
|
300
|
+
return Sprintf("%o._from_dict({%o})", SF, dict), false;
|
|
301
|
+
end intrinsic;
|
|
302
|
+
|
|
303
|
+
/* Elliptic curves */
|
|
304
|
+
|
|
305
|
+
intrinsic Sage(X::CrvEll) -> MonStgElt, BoolElt
|
|
306
|
+
{}
|
|
307
|
+
as := aInvariants(X);
|
|
308
|
+
return Sprintf("EllipticCurve(%o)", Sage(as)), true;
|
|
309
|
+
end intrinsic;
|
|
310
|
+
|
|
311
|
+
/* Hyperelliptic curves */
|
|
312
|
+
|
|
313
|
+
intrinsic Sage(X::CrvHyp) -> MonStgElt, BoolElt
|
|
314
|
+
{}
|
|
315
|
+
f, g := HyperellipticPolynomials(X);
|
|
316
|
+
return Sprintf("HyperellipticCurve(%o, %o)", Sage(f), Sage(g)), true;
|
|
317
|
+
end intrinsic;
|
|
318
|
+
|
|
319
|
+
/* Modules and vector spaces */
|
|
320
|
+
|
|
321
|
+
intrinsic Sage(X::ModTupRng) -> MonStgElt, BoolElt
|
|
322
|
+
{}
|
|
323
|
+
if IsIdentity(InnerProductMatrix(X)) then
|
|
324
|
+
return Sprintf("FreeModule(%o, %o)", Sage(BaseRing(X)), Sage(Rank(X))), true;
|
|
325
|
+
else
|
|
326
|
+
return Sprintf("FreeModule(%o, %o, inner_product_matrix=%o)", Sage(BaseRing(X)), Sage(Rank(X)), Sage(InnerProductMatrix(X))), true;
|
|
327
|
+
end if;
|
|
328
|
+
end intrinsic;
|
|
329
|
+
|
|
330
|
+
intrinsic Sage(X::ModTupRngElt) -> MonStgElt, BoolElt
|
|
331
|
+
{}
|
|
332
|
+
return Sprintf("%o(%o)", Sage(Parent(X)), Sage(ElementToSequence(X))), true;
|
|
333
|
+
end intrinsic;
|
|
334
|
+
|
|
335
|
+
/* Power series rings */
|
|
336
|
+
|
|
337
|
+
intrinsic Sage(X::RngSerPow) -> MonStgElt, BoolElt
|
|
338
|
+
{}
|
|
339
|
+
txt := "PowerSeriesRing(%o, %o)";
|
|
340
|
+
var := Sprintf("['%o']", X.1);
|
|
341
|
+
return Sprintf(txt, Sage(BaseRing(X)), var), false;
|
|
342
|
+
end intrinsic;
|
|
343
|
+
|
|
344
|
+
intrinsic Sage(X::RngSerLaur) -> MonStgElt, BoolElt
|
|
345
|
+
{}
|
|
346
|
+
txt := "LaurentSeriesRing(%o, %o)";
|
|
347
|
+
var := Sprintf("['%o']", X.1);
|
|
348
|
+
return Sprintf(txt, Sage(BaseRing(X)), var), false;
|
|
349
|
+
end intrinsic;
|
|
350
|
+
|
|
351
|
+
intrinsic Sage(X::RngSerPuis) -> MonStgElt, BoolElt
|
|
352
|
+
{}
|
|
353
|
+
txt := "PuiseuxSeriesRing(%o, %o)";
|
|
354
|
+
var := Sprintf("['%o']", X.1);
|
|
355
|
+
return Sprintf(txt, Sage(BaseRing(X)), var), false;
|
|
356
|
+
end intrinsic;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
basic.m
|
sage/ext_data/magma/spec
ADDED