🌱 Foundations & interface
Accessing Sage in the browser or locally, running cells, understanding the notebook structure, and seeing your first plots and symbolic expressions.
A practice space where NAMSSN UI students can use SageMath as a free, research-grade environment for algebra, number theory, combinatorics, determinants, and experiment-driven proofs.
SageMath is an open-source system built on top of Python. It glues together many powerful libraries — for algebra, number theory, geometry, combinatorics, and more — into a single language that feels close to mathematics.
In this lab, SageMath is treated as a thinking space: a place to test conjectures, search for patterns, compute determinants, and keep structured notes that look like early research notebooks.
A student who patiently works through the modules and uses SageMath on real UI problems will be able to open a fresh notebook and guide themselves through computations and experiments confidently.
Accessing Sage in the browser or locally, running cells, understanding the notebook structure, and seeing your first plots and symbolic expressions.
Polynomials, fields, rings, modular arithmetic, primes, and integer sequences — all aligned with core algebra and number theory courses at UI.
Graphs, combinatorial objects, linear algebra experiments, determinants, and mini projects that turn Sage computations into short, well-structured write-ups.
Start here if you have never used SageMath before. By the end of this module you should know how to open a notebook, run cells, and understand the basic idea of Sage objects.
The easiest first contact is through a browser: a Sage server, CoCalc, or a local Jupyter notebook. A typical first cell might be:
2 + 32^10factor(2^16 - 1)Goal: press “Run Sage” without fear and read the output calmly.
Sage distinguishes between plain Python integers and Sage integers. To work in the Sage world, you can write:
ZZ(5) # an integer in Sage’s integer ringQQ(1/3) # an exact rational numberQQ(1) / 3Here you meet Sage’s polynomial rings and basic function plots. This is a direct companion to algebra and calculus courses.
In Sage, you explicitly create a polynomial ring and a variable:
R.<x> = QQ[]f = x^4 - 5*x^2 + 4factor(f)Basic plotting is very close to mathematics notation:
var('x')plot(sin(x)/x, (x, -10, 10))plot([sin(x), cos(x)], (x, 0, 2*pi))Now you use Sage as a genuine playground for primes, congruences, and combinatorial structures.
Sage has built-in support for modular arithmetic and prime-related functions:
Integers(17)Mod(5, 17)^-1[next_prime(n) for n in [10, 100, 1000]]You can construct graphs and measure simple invariants:
G = graphs.CompleteGraph(5)G.degree_sequence()G.plot()In this module you treat Sage as a serious assistant: you explore matrices, determinants, eigenvalues, and search for examples and counterexamples to conjectures.
You can move quickly from a matrix definition to its key properties:
A = matrix([[1,2,3],[0,1,4],[0,0,1]])A.det() (determinant)A.eigenvalues() (eigenvalues)This is the natural place to compute many determinants quickly and compare patterns with theoretical results.
Instead of guessing blindly, you can let Sage search through many small cases:
[n for n in range(2,200) if not is_prime(n^2 + 1)][A^k for k in range(2,10)] (checking behaviour of a matrix power)
This cell talks to the public SageCell server at sagecell.sagemath.org.
Work in the scratchpad first, then use “Send to live cell” when you are ready to run
the code and see the output.
Heads up: because the live cell uses an external Sage server, it may feel slow or briefly unavailable at times. That is usually the remote server, not your browser. In future, the same buttons here can point to a Sage server hosted at UI without students changing their habits.
This pad is a planning space; it does not execute Sage. It is useful for collecting commands, trying variations, and saving snippets.
nt-2025-01.sage).