SharedTry-Python3-based-SageMath-in-Jupyter.ipynbOpen in CoCalc
Try Python3-based SageMath in Jupyter

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))