From ea018ab15effe7d7cde39bd5fb27ba84e2620d99 Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 9 Mar 2014 23:53:01 +0100 Subject: [PATCH] include trigonometric function values for a step size of pi/6 --- anki-sin-cos-table.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/anki-sin-cos-table.py b/anki-sin-cos-table.py index bbfc874..fddfb15 100644 --- a/anki-sin-cos-table.py +++ b/anki-sin-cos-table.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from collections import OrderedDict from functools import reduce from sympy import latex, simplify @@ -14,8 +15,12 @@ def as_csv(*values): return reduce(lambda a, b: a + ";" + b, values) -xs = map(simplify, - [i * pi / 4 for i in range(-16, 16)]) +def deduplicate(iterable): + return list(OrderedDict.fromkeys(iterable)) + + +xs = sorted(deduplicate(map(simplify, + [i * pi / 4 for i in range(-16, 16)] + [i * pi / 6 for i in range(-24, 24)]))) for x in xs: for f in [sin, cos, tan]: