Abstract

Gonzalo Tornaria and Joe Wetherell and others designed and implemented this at the SAGE Days coding spring. It’s amazing! It allows you to embed arbitrary SAGE code and its output in latex documents, and works like any other latex package.

Embedding SAGE In Latex: Examples

March 21, 2013

This is an example 1 + 2 + 3 = 6 and also 2+3=5. Now we evaluate the following block:

sageblock 3 Now the elliptic curve E given by y^{2} + y =

x^{3} − x has discriminant 37.

There are problems with the spacing, but this is easily fixed. sageblock 6 Consider the matrix

A^{2} = ( \begin{matrix}2850 & 2895 & 2940 & 2985 & 3030 & 3075 & 3120 & 3165 & 3210 & 3255 \\ 7350 & 7495 & 7640 & 7785 & 7930 & 8075 & 8220 & 8365 & 8510 & 8655 \\ 11850 & 12095 & 12340 & 12585 & 12830 & 13075 & 13320 & 13565 & 13810 & 14055 \\ 16350 & 16695 & 17040 & 17385 & 17730 & 18075 & 18420 & 18765 & 19110 & 19455 \\ 20850 & 21295 & 21740 & 22185 & 22630 & 23075 & 23520 & 23965 & 24410 & 24855 \\ 25350 & 25895 & 26440 & 26985 & 27530 & 28075 & 28620 & 29165 & 29710 & 30255 \\ 29850 & 30495 & 31140 & 31785 & 32430 & 33075 & 33720 & 34365 & 35010 & 35655 \\ 34350 & 35095 & 35840 & 36585 & 37330 & 38075 & 38820 & 39565 & 40310 & 41055 \\ 38850 & 39695 & 40540 & 41385 & 42230 & 43075 & 43920 & 44765 & 45610 & 46455 \\ 43350 & 44295 & 45240 & 46185 & 47130 & 48075 & 49020 & 49965 & 50910 & 51855 \end{matrix} )

defined in SAGE code above.

It’s also possible to do caching!

         sageblock 8

The 9999’s Fourier coefficient of y^{2} + xy + 3y = x^{3} + 2x^{2} + 4x + 5 is −27.

         sageblock 11

We have

∫ e^{x} cos x sin^{2} xdx = − \frac{3 e^{x} sin (3 x) + e^{x} cos (3 x) − 5 e^{x} sin x − 5 e^{x} cos x}{40} .

In Axiom it looks like this:

         sageblock 14

We have

∫ ?dx =?.

This year is 2006 =?. Next lets compute in a polynomial ring. ?

         sageblock 18

Consider f =?. Notice that the 10th power of f is f^{10} =?. The factorization of ? is ?.