You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
398 B
Python

#!/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