Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Try Python3-based SageMath in Jupyter

Project: sage-python3
Views: 316
Kernel: Sage Py3

Try Python3-based SageMath in Jupyter

Let's check which version of Sage and of Python this is.

print(version()) # SageMath version
SageMath version 8.4.rc0, Release Date: 2018-10-07
print(sys.version) # Python version
3.6.6 (default, Oct 10 2018, 07:37:57) [GCC 7.3.0]

Let's check some stuff that works differently in Python 2 and Python 3.

range(10)
range(0, 10)
print 2
File "<ipython-input-4-01aef55c34fb>", line 1 print Integer(2) ^ SyntaxError: invalid syntax
print(2)
2

Let's check some Sage functionality

matrix(ZZ, 2)
[0 0] [0 0]
M = ModularSymbols(23)
M
Modular Symbols space of dimension 5 for Gamma_0(23) of weight 2 with sign 0 over Rational Field
M.basis()
((1,0), (1,17), (1,19), (1,20), (1,21))