From c31c800edfd3085d8c21c1821cf9c63691299b1a Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 28 Feb 2014 00:13:36 +0100 Subject: [PATCH] add a program generating a sin/cos table for anki --- anki-sin-cos-table.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 anki-sin-cos-table.py 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