Archived May, 2026.

Sage cells

mark

Discourse at MarksMath provides the ability to easily embed SageMath Cells into its posts using the Sage Cell Server. Here, for example, is some a fenced code block tagged as sage:

```sage
f(x) = x^5 - x^2 - 5*x - 1
roots = f(x).diff(x).roots(ring=RR)
print(roots)

pts = [(x[0], f(x[0])) for x in roots]
plot(f(x), [x,-2,2]) + point(pts, size=40, color='red')
```

If we type that into a forum post, it should render as so:

f(x) = x^5 - x^2 - 5*x - 1
cps = f(x).diff(x).roots(ring=RR)
print(cps)

pts = [(x[0], f(x[0])) for x in cps]
plot(f(x), [x,-2,2]) + point(pts, size=40, color='red')

That's active code. If you press the "Run" button, the code should execute to display a graph of the function with the critical points highlighted. Of course, you can also edit the code to explore variations of the function or anything else in SageMath.