SageTeX
In this preview: press Run to run the code with Sagebrush’s Sage, in this browser, in page order; until then each \sage{...} shows as a placeholder. The results are kept beside this file (sagebrush latex run on a computer makes the same file); after an edit, press Run again.
The derivative of
f(x)=x3−2x+1 is
f′(x)=3x2−2, and
∫01f(x)dx=41.
The 10th prime is
29, and
2100=1267650600228229401496703205376.
Code runs in page order, so a name can be defined again: from here on
f(x)=sin(x).