:= PowerSeriesRing(S); // W is S[[q]] > W; Power series ring in q over IntegerRing(12) > 1/(1+q); // arithmetic in S[[q]]. 1 + 11*q + q^2 + 11*q^3 + q^4 + 11*q^5 + O(q^6) \end{verbatim} \section{Finite Fields} Support for basic arithmetic over finite fields is a dream because a choice of $\Fbar_p$ is built in. There is a fixed compatible choice of maps $\F_{p^n}\hookrightarrow \F_{p^{nm}}$ for all $n,m\geq 1$. \begin{verbatim} > K := GF(3^2); > MinimalPolynomial(a); $.1^2 + 2*$.1 + 2 > // The $.1 means "the first unnamed generator". $.2 would be the second, etc. > L:= GF(3^6); // b generates L^* > L!a; // image of a in L. b^91 // sweet. > A := MatrixAlgebra(L,2)![b,2,0,1]; > A; [ b 2] [ 0 1] > V := VectorSpace(L,2); > v := V.1; > v; ( 1 0) > v*A; // WARNING: In Australia, matrices act ON THE RIGHT! ( b 2) \end{verbatim} %> G := GeneralLinearGroup(2,K); // build structures upon structures %> #G; %5760 %> Generators(G); %{ %[ 2 1] %[ 2 0], % %[ a 0] %[ 0 1] %} \section{Commutative Algebra and Geometry} It is easy and natural to work with quotients of polynomial rings and ideals in MAGMA. \begin{verbatim} > // The field K = Q(a,b,x0,x1,x2) > K := FieldOfFractions(PolynomialRing(Rationals(),5)); Rational function field of rank 5 over Rational Field Variables: a, b, x0, x1, x2 > // The polynomial ring R = K[y0,y1,y2] > R:= PolynomialRing(K,3); Polynomial ring of rank 3 over Rational function field of rank 5 over Rational Field [...] > // A maximal ideal of R. > I := ideal ; \end{verbatim} The quotient $L = R/I$ contains three generic points on the elliptic curve $y^2 = x^3 + ax + b$. \begin{verbatim} > L := quo ; Affine Algebra of rank 3 over [...] > E := EllipticCurve([L| a,b]); Elliptic Curve defined by y^2 = x^3 + a*x + b over Affine Algebra of rank 3 over Rational function field of rank 5 over Rational Field Variables: a, b, x0, x1, x2 > P0 := E![L|x0,y0]; P1 := E![L|x1,y1]; P2 := E![L|x2,y2]; > P0 + P1; (-2/(x0^2 - 2*x0*x1 + x1^2)*y0*y1 + ... > // left and right are huge -- you probably don't want to print them out. > left := (P0 + P1) + P2; right := P0 + (P1 + P2); > left eq right; true \end{verbatim} \section{Unique Flexibility} This is a short example which demonstrates the flexibility of the system. \begin{verbatim} > R := PolynomialRing(Integers()); > f := x^3+1; > Factorization(f); [ , ] > S := PolynomialRing(pAdicField(7)); > Factorization(S!f); [ , <(1 + O(7^20))*x - 22143577275619761 + O(7^20), 1>, <(1 + O(7^20))*x + 22143577275619760 + O(7^20), 1> ] > W := PolynomialRing(GF(7)); > Factorization(W!f); [ , , ] > F := GF(5^2); > R5:= PolynomialRing(F); > Factorization(R5!f); [ , , ] \end{verbatim} \section{Some Frequently Asked Questions} \begin{question} Is there an equivalent to a {\tt .magmarc} where initial commands can be loaded? (e.g., setting {\tt vi} or {\tt emacs} mode) \end{question} Yes. Set the environment variable {\tt MAGMA\_STARTUP\_FILE} to the file you want \magma{} to execute at startup. Also, you should learn about {\tt spec} files. Check out \begin{verbatim} http://modular.fas.harvard.edu/docs/magma/htmlhelp/text122.html#247 \end{verbatim} \begin{question} When running magma I tend to have a separate window with the documentation available, but also sometimes type {\tt ?X} for some {\tt X}; sometimes the output of available options is more than a screen long; is there a way to make a paginator (e.g., less) do this automatically, a page at a time? \end{question} I {\em never} use {\tt ?X} for help. Use the HTML help, which comes with \magma{}. You can also use it by viewing: \begin{verbatim} http://modular.fas.harvard.edu/docs/magma/htmlhelp/MAGMA.html \end{verbatim} This HTML help is generated from exactly the same \TeX{} source files as the {\tt ?} help, but by using the index it is easier to view. \begin{question} How can one refer to the output of the most recent command? \end{question} \begin{verbatim} $ and $1, $2, $3. \end{verbatim} \begin{question} What are the easy ways for storing output in a file? \end{question} Here's an example. \begin{verbatim} > file := Open("testfile","w"); > fprintf file, "hello world"; > Flush(file); > r := Open("testfile","r"); > Gets(r); hello world \end{verbatim} You can read about file I/O commands at \begin{verbatim} http://modular.fas.harvard.edu/docs/magma/htmlhelp/text130.html#363 \end{verbatim} \begin{question} Is there a simple way to take an polynomial in $x$ and replace $x$ by some other expression? \end{question} No, because that doesn't make \magma{}matically rigorous sense in general. However, in cases where what you want to do does make sense (which should always be the case, I trust), you can use the {\tt hom} construction. Here is an example: \begin{verbatim} > R := PolynomialRing(RationalField()); > phi := hom< R -> RationalField() | 4>; > phi(x^2+1); 17 \end{verbatim} \end{document}