Jump to content

SageMath

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 80.98.242.95 (talk) at 21:05, 26 October 2009 (Calculus: simplify log missing). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Sage
Initial release24 February 2005
Stable release
4.1.2 / October 15, 2009; 15 years ago (2009-10-15)
Repository
Written inPython, Cython
Operating systemCross-platform
PlatformPython
TypeComputer algebra system
LicenseGNU General Public License
WebsiteSage: Open Source Mathematics Software

Sage is a software application which covers many aspects of mathematics, including algebra, combinatorics, numerical mathematics, and calculus. It has a wide range area of application, including engineering, science, etc.

The first version of Sage was released on 24 February 2005 as free and open source software under the terms of the GNU General Public License, with the initial goals of creating an "open source alternative to Magma, Maple, Mathematica, and MATLAB."[1] The lead developer of Sage, William Stein, is a mathematician at the University of Washington.

Features

The Sage notebook document interface works with Firefox (and Mozilla), Opera, Konqueror, and Safari.
Equation solving and typesetting using the Sage notebook web interface

Some of the many features of Sage include[2].

Although not provided by Sage directly, Sage can be called from within Mathematica[5]. A Mathematica notebook is available for this [6]

Design Philosophy of Sage

William Stein realized several important facts when designing Sage.

  • To create viable alternatives to Magma, Maple, Mathematica, and MATLAB, would take hundreds, or thousands of man-years if one started from the beginning.
  • There was a huge range of well-tested open-source mathematics software already written, but which was written in different languages (C, C++, Fortran and Python being the most common).

So rather than start from the beginning, Sage which is written in Python and Cython integrates all their specialized mathematics software into a common interface. A user needs to know only Python, which is a well known programming language, used in thousands of different applications.

Where no open-source option exists for a particular class of problem, then this would be written in Sage. But Sage does not reinvent the wheel. The same design philosophy is used in commercial mathematics program such as Mathematica, but Sage can use a much wider range of open source software solutions than nonfree software, since proprietary licensing imposes severe restrictions on reusing knowledge.

Sage development employs both students and professionals for development. The development of Sage is supported by both volunteer work and grants.[7]

In 2007, Sage won first prize in the scientific software division of Les Trophées du Libre, an international competition for free software.[8]

Performance

Both binaries and source code are available for sage from the download page. If Sage is built from source code, many of the included libraries such as ATLAS, FLINT, and NTL will be tuned and optimized for that computer, taking into account the number of processor, the size of their caches, whether there is hardware support for SSE instructions etc. Many of the developers are passionate about performance, and often push to produce the fastest implementation in the world for a given task.

Licensing and availability

Sage is free software, distributed under the terms of the GNU General Public License version 2+. Sage is available in many ways:

  • The source code can be downloaded from the downloads page. Although not recommended for end users, development releases of Sage are also available.
  • Binaries can be downloaded for Linux, OS X and Solaris (both x86 and SPARC). The Solaris binaries are currently considered experimental.
  • A live CD containing a bootable Linux operating system is also available. This allows Sage to be tried, without being installed.
  • Users can use an online version of Sage at http://demo.sagenb.org, but for technical reasons it is necessary to limit the amount of memory a user can use, as well as impose security restrictions.

Although Microsoft is sponsoring a native version of Sage to the Windows operating system[citation needed], users of Windows will currently have to install the free VMWare Player and install a VMWare image of Sage, available from the Sage download page.

Software packages contained in Sage

As stated above, the philosophy of Sage is to use

Mathematics packages contained in Sage
Algebra GAP, Maxima, Singular
Algebraic Geometry Singular
Arbitrary Precision Arithmetic GMP, MPFR, MPFI, NTL
Arithmetic Geometry PARI, NTL, mwrank, ecm
Calculus Maxima, SymPy, GiNaC
Combinatorics Symmetrica, Sage-Combinat
Linear Algebra Linbox, IML
Graph Theory NetworkX
Group Theory GAP
Numerical computation GSL, SciPy, NumPy, ATLAS
Other packages contained in Sage
Command line IPython
Database ZODB, Python Pickles, SQLite
Graphical Interface Sage Notebook, jsmath
Graphics Matplotlib, Tachyon3d, GD, Jmol
Interactive programming language Python
Networking Twisted

Command interface examples

Calculus

x,a,b,c = var('x,a,b,c')

log(sqrt(a)).simplify_log()             # returns log(a)/2
log(a/b).simplify_log()                 # returns log(a) - log(b)
sin(a+b).simplify_trig()                # returns cos(a)*sin(b) + sin(a)*cos(b)
cos(a+b).simplify_trig()                # returns cos(a)*cos(b) - sin(a)*sin(b)
(a+b)ˆ5                                 # returns (b + a)ˆ5
expand((a+b)ˆ5)                         # returns bˆ5 + 5*a*bˆ4 + 10*aˆ2*bˆ3 +
                                        #         10*aˆ3*bˆ2 + 5*aˆ4*b + aˆ5

limit((xˆ2+1)/(2+x+3*xˆ2), x=infinity)  # returns 1/3
limit(sin(x)/x, x=0)                    # returns 1

diff(acos(x),x)                         # returns -1/sqrt(1 - xˆ2)
f = exp(x)*log(x)
f.diff(x,3)                             # returns e^x*log(x) + 3*e^x/x - 3*e^x/x^2 + 2*e^x/x^3

solve(a*x^2 + b*x + c, x)               # returns [x == (-sqrt(b^2 - 4*a*c) - b)/(2*a),
                                        #          x == (sqrt(b^2 - 4*a*c) - b)/(2*a)]

f = xˆ2 + 432/x
solve(f.diff(x)==0,x)                   # returns [x == 3*sqrt(3)*I - 3,
                                        #          x == -3*sqrt(3)*I - 3, x == 6]

Differential equations

t = var('t')                            # define a variable t
x = function('x',t)                     # define x to be a function of that variable
DE = lambda y: diff(y,t) + y - 1
desolve(DE(x(t)), [x,t])                # returns '%e^-t*(%e^t+%c)'

Linear algebra

A = Matrix([[1,2,3],[3,2,1],[1,1,1]])
y = vector([0,-4,-1])
A.solve_right(y)                        # returns (-2, 1, 0)
A.eigenvalues()                         # returns [5, 0, -1]

B = Matrix([[1,2,3],[3,2,1],[1,2,1]])
B.inverse()                             # returns [   0  1/2 -1/2]
                                        #         [-1/4 -1/4    1]
                                        #         [ 1/2    0 -1/2]

# Call numpy for the Moore-Penrose pseudo-inverse,
# since Sage does not support that yet.

import numpy
C = Matrix([[1 , 1], [2 , 2]])
matrix(numpy.linalg.pinv(C.numpy()))    # returns [0.1 0.2]
                                        #         [0.1 0.2]

Number Theory

prime_pi(1000000)                       # returns 78498, the number of primes less than one million

E = EllipticCurve('389a')               # construct an elliptic curve from its Cremona label
P, Q = E.gens()
7*P + Q                                 # returns (2869/676 : -171989/17576 : 1)

History

Only the major releases are listed below. Sage practices the "Release early. Release often" concept, with releases every two to three weeks.

Sage versions
Version Release Date Description
0.1 January, 2005 Included Pari, but not GAP or Singular
0.2 - 0.4 March to July 2005 Cremona's database, multivariate polynomials, large finite fields and more documentation
0.5 - 0.7 August to September 2005 Vector spaces, rings, modular symbols, and windows usage
0.8 October 2005 Full distribution of GAP, Singular
0.9 November, 2005 Maxima and clisp added
1.0 February, 2006
2.0 January, 2007
3.0 April, 2008
4.0 May, 2009

See also

Template:Fossportal

References

  1. ^ Stein, William (2007-06-12). "SAGE Days 4" (PDF). Retrieved 2007-08-02.
  2. ^ Sage documentation
  3. ^ "Sage Interact functionality". Retrieved 2008-04-11.
  4. ^ [1]
  5. ^ http://facstaff.unca.edu/mcmcclur/Mathematica/Sage/ Calling Sage from Mathematica
  6. ^ http://facstaff.unca.edu/mcmcclur/Mathematica/Sage/UsingSage.nb A Mathematica notebook to call Sage from Mathematica.
  7. ^ "Explicit Approaches to Modular Forms and Modular Abelian Varieties". National Science Foundation. 2006-04-14. Retrieved 2007-07-24.
  8. ^ "Free Software Brings Affordability, Transparency To Mathematics". Science Daily. December 7 2007. Retrieved 2008-07-20. {{cite web}}: Check date values in: |date= (help)