# HG changeset patch
# User Nils Bruin <nbruin@sfu.ca>
# Date 1310742073 25200
# Node ID 4fc30672ecde8c0e99ff23ba962c6e54b0b3381a
# Parent 8532a2ad1e558cbc91ddaaa6b7cc79956dd1e8ba
trac 11580: Include doctests for enhanced magma-to-sage translation
diff --git a/sage/interfaces/magma.py b/sage/interfaces/magma.py
|
a
|
b
|
class MagmaElement(ExpectElement): |
| 1896 | 1896 | [1, 2, 2, 2, 3, 4, 4] |
| 1897 | 1897 | sage: type(z) # optional - magma |
| 1898 | 1898 | <type 'list'> |
| 1899 | | |
| | 1899 | |
| | 1900 | Tuples get converted to tuples:: |
| | 1901 | |
| | 1902 | sage: m = magma('<1,2,<3>>') # optional - magma |
| | 1903 | sage: z = m.sage(); z # optional - magma |
| | 1904 | (1, 2, (3,)) |
| | 1905 | sage: type(z) # optional - magma |
| | 1906 | <type 'tuple'> |
| | 1907 | |
| | 1908 | Sequences get converted to lists:: |
| | 1909 | |
| | 1910 | sage: m = magma('[<1>,<2>]') # optional - magma |
| | 1911 | sage: z = m.sage(); z # optional - magma |
| | 1912 | [(1,), (2,)] |
| | 1913 | sage: type(z) # optional - magma |
| | 1914 | <type 'list'> |
| | 1915 | |
| 1900 | 1916 | Matrices:: |
| 1901 | 1917 | |
| 1902 | 1918 | sage: a = matrix(ZZ,3,3,[1..9]) |
| … |
… |
class MagmaElement(ExpectElement): |
| 1915 | 1931 | sage: m.sage() # optional - magma |
| 1916 | 1932 | [1 2 3] |
| 1917 | 1933 | [4 5 6] |
| | 1934 | |
| | 1935 | Multivariate polynomials:: |
| | 1936 | |
| | 1937 | sage: R.<x,y,z> = QQ[] # optional - magma |
| | 1938 | sage: f = x^2+3*y # optional - magma |
| | 1939 | sage: g = magma(f).sage(); g # optional - magma |
| | 1940 | x^2 + 3*y |
| | 1941 | sage: parent(f) == parent(g) # optional - magma |
| | 1942 | True |
| | 1943 | |
| 1918 | 1944 | """ |
| 1919 | 1945 | z, preparse = self.Sage(nvals = 2) |
| 1920 | 1946 | s = str(z) |