Department of Mathematics FAS Harvard University One Oxford Street Cambridge MA 02138 USA Tel: (617) 495-2171 Fax: (617) 495-5132
FAS Computer Services to Harvard University IT: (617) 495-7777.


Magma is a software package for solving computationally hard problems in algebra, number theory, geometry and combinatorics. It provides a mathematically rigorous environment for computing with algebraic, number-theoretic, combinatoric and geometric objects. Magma can be compared with Mathematica, Maple or Matlab. It strength is in having built-in cutting edge and the most sophisticated algorithms known. Magma runs at the Mathematics department on the machine modular.fas.harvard.edu, for which you need a separate account. More Magma (and Pari ) documentation can be found here .
Snippets of code examples: (watching simple examples is a good way to learn and appreciate the language). Some of the examples have been taken from the Magma documentation. More examples are available here .

amicable.magma Amicable numbers, how to make loops
complex.magma Complex numbers, calculation with arbitrary precision
factorisation.magma Factor integers, with report on used time
factorpolynomial.magma Factor polynomials over finite fields
factorpolynomialz.magma Factor polynomials over integer ring
simplelist.magma Building a simple list
lists.magma Doing operations on Lists
primes.magma Print list of primes up to 100000
farey.magma Factor polynomials over integer ring, how to define functions
finitefield.magma defining polynomial for a finite field
groebner.magma get the Groebner Basis of an ideal
group.magma finitely presented group parametrized by parameters in relations, how to make lists
infinitegroup.magma defining an infinite finitely presented group
knapsack.magma Solving the knapsack problem, simple programming example
matrixgroup.magma Working with Matrix groups
permutation.magma Defining a permutation group generated by a few permutations
subgroup.magma finding the subgroup lattice of a group
primenumber.magma Illustration of the prime number theorem, example with formatted output
sumsquare.magma Writing number as a sum of two squares


Simplicity, Clarity, Generality B.W. Kernighan, R. Pike, in "The Practice of Programming".
Privacy Digital Accessibility
HTML CSS