PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Sage

Sage

Sage is a pl created in 2005.

#79on PLDB 17Years Old 1.1kUsers
2Books 2Papers 499Repos

Try now: Riju

SageMath (previously Sage or SAGE, "System for Algebra and Geometry Experimentation") is a mathematical software with features covering many aspects of mathematics, including algebra, combinatorics, numerical mathematics, number theory, and calculus. The first version of SageMath was released on 24 February 2005 as free and open-source software under the terms of the GNU General Public License version 2, with the initial goals of creating an "open source alternative to Magma, Maple, Mathematica, and MATLAB". The originator and leader of the SageMath project, William Stein, is a mathematician at the University of Washington. Read more on Wikipedia...


Example from Riju:
print("Hello, world!")
Example from Linguist:
# -*- coding: utf-8 -*- # # Funciones en Python/Sage para el trabajo con polinomios con una # inc贸gnita (x). # # Copyright (C) 2014-2015, David Abi谩n <davidabian [at] davidabian.com> # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along with # this program. If not, see <http://www.gnu.org/licenses/>. def pols (grado=-1, K=GF(2), mostrar=False): """Devuelve la lista de polinomios constantes y no constantes de coeficientes m贸nicos y grado igual o menor que el especificado. Si el grado indicado no es v谩lido, devuelve una lista vac铆a. """ lpols = [] if not grado.is_integer(): grado = grado.round() if grado >= 0: var('x') xs = vector([(x^i) for i in range(grado+1)]) V = VectorSpace(K,grado+1) lpols = [cs*xs for cs in V] if mostrar: for pol in lpols: print pol return lpols def polsNoCtes (grado=-1, K=GF(2), mostrar=False): """Devuelve la lista de polinomios no constantes de coeficientes m贸nicos y grado igual o menor que el especificado. Si el grado indicado no es v谩lido, devuelve una lista vac铆a. """ lpols = [] if not grado.is_integer(): grado = grado.round() if grado >= 0: var('x') xs = vector([(x^i) for i in range(grado+1)]) for cs in K^(grado+1): if cs[:grado] != vector(grado*[0]): # no constantes lpols += [cs*xs] if mostrar: for pol in lpols: print pol return lpols def polsMismoGrado (grado=-1, K=GF(2), mostrar=False): """Devuelve la lista de polinomios de coeficientes m贸nicos del grado especificado. Si el grado indicado no es v谩lido, devuelve una lista vac铆a. """ lpols = [] if not grado.is_integer(): grado = grado.round() if grado >= 0: var('x') xs = vector([(x^(grado-i)) for i in [0..grado]]) for cs in K^(grado+1): if cs[0] != 0: # polinomios del mismo grado lpols += [cs*xs] if mostrar: for pol in lpols: print pol return lpols def excluirReducibles (lpols=[], mostrar=False): """Filtra una lista dada de polinomios de coeficientes m贸nicos y devuelve aquellos irreducibles. """ var('x') irreds = [] for p in lpols: fp = (p.factor_list()) if len(fp) == 1 and fp[0][1] == 1: irreds += [p] if mostrar: for pol in irreds: print pol return irreds def vecPol (vec=random_vector(GF(2),0)): """Transforma los coeficientes dados en forma de vector en el polinomio que representan. Por ejemplo, con vecPol(vector([1,0,3,1])) se obtiene x鲁 + 3*x + 1. Para la funci贸n opuesta, v茅ase polVec(). """ var('x') xs = vector([x^(len(vec)-1-i) for i in range(len(vec))]) return vec*xs def polVec (p=None): """Devuelve el vector de coeficientes del polinomio dado que acompa帽an a la inc贸gnita x, de mayor a menor grado. Por ejemplo, con polVec(x^3 + 3*x + 1) se obtiene el vector (1, 0, 3, 1). Para la funci贸n opuesta, v茅ase vecPol(). """ cs = [] if p != None: var('x') p(x) = p for i in [0..p(x).degree(x)]: cs.append(p(x).coefficient(x,i)) cs = list(reversed(cs)) return vector(cs) def completar2 (p=0): """Aplica el m茅todo de completar cuadrados en par谩bolas al polinomio dado de grado 2 y lo devuelve en su nueva forma. Si el polinomio dado no es v谩lido, devuelve 0. Por ejemplo, con complCuad(3*x^2 + 12*x + 5) se obtiene 3*(x + 2)^2 - 7. """ var('x') p(x) = p.expand() if p(x).degree(x) != 2: p(x) = 0 else: cs = polVec(p(x)) p(x) = cs[0]*(x+(cs[1]/(2*cs[0])))^2+(4*cs[0]*cs[2]-cs[1]^2)/(4*cs[0]) return p(x)
Example from Wikipedia:
sage: E2 = EllipticCurve(CC, [0,0,-2,1,1]) sage: E2 Elliptic Curve defined by y^2 + (-2.00000000000000)*y = x^3 + 1.00000000000000*x + 1.00000000000000 over Complex Field with 53 bits of precision sage: E2.j_invariant() 61.7142857142857

Language features

Feature Supported Example Token
Comments
# A comment
Line Comments
# A comment
#
Semantic Indentation

Books about Sage from ISBNdb

title authors year publisher
Sage for Undergraduates Gregory V. Bard 2015 American Mathematical Society
Numerical Analysis Using Sage (Springer Undergraduate Texts in Mathematics and Technology) Anastassiou, George A. and Mezei, Razvan A. 2015 Springer

Publications about Sage from Semantic Scholar

title authors year citations influentialCitations
An Introduction to SAGE Programming Razvan A. Mezei 2015 8 2
Numerical Analysis Using Sage G. Anastassiou and Razvan A. Mezei 2015 2 0
uml.html 路 sagemath.html 路 yacc.html

View source

PLDB - Build the next great programming language 路 v2022 Day 31 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com