# Interactive mathlets with Sage

## “Mathlets”?

### Applets for math.

A “mathlet” is a small, interactive applet used to demonstrate or experiment with mathematical ideas. They are often web-based and written in Java.

You can easily make mathlets with Sage's “@interact” feature. And the embeddable Sage cell server means you can put @interacts anywhere — including right into this presentation!

## Example: Taylor polynomials

Taylor polynomials for $$\sin(x^2 + 1)\sqrt{x+2}$$:

The sequence

• $$\frac{1}{4} \sqrt{2} \sin\left(1\right) x + \sqrt{2} \sin\left(1\right) + \mathcal{O}(x^2)$$
• $$-\frac{1}{32} \left(\sin\left(1\right) - 32 \cos\left(1\right)\right) \sqrt{2} x^{2} + \frac{1}{4} \sqrt{2} x \sin\left(1\right) + \sqrt{2} \sin\left(1\right) + \mathcal{O}(x^3)$$
• ...
doesn't say much to me.

Making a bunch of drawings is better, but can you make them look good? Make them correct? Convey the idea of a sequence of polynomials converging to the original function? If not...

## Taylor polynomials, continued

This is the “canonical” example from the Sage wiki.

## Try it yourself

2. Cut and paste some code from wiki.sagemath.org/interact or these slides.
3. Enjoy!

## Thank you

These slides online at goo.gl/Nx9U3

## Credits

• Thanks to Jason Grout and his students for the Sage cell server.
• Thanks to Ira Hanson for CSS help.
• The Newton's method code is available from gist.github.com/2469090.
• Dyck/Schröder code (and my paper) is at arXiv:1006.1959.