commit c31c800edfd3085d8c21c1821cf9c63691299b1a Author: neingeist Date: Fri Feb 28 00:13:36 2014 +0100 add a program generating a sin/cos table for anki diff --git a/anki-sin-cos-table.py b/anki-sin-cos-table.py new file mode 100644 index 0000000..ea9daae --- /dev/null +++ b/anki-sin-cos-table.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python2.7 +from sympy import Symbol, latex, simplify +from sympy import pi, sin, cos, tan + +def ankilatex(e): + """ Format sympy expression as Anki LaTeX""" + return "[$$]" + latex(e) + "[/$$]" + +for i in range(-16, 16): + x = simplify(i*pi/4) + + for f in [sin, cos, tan]: + print "What is " + ankilatex(f(x, evaluate=False)) + "?", + print ";", + print ankilatex(f(x)), + print