Here's exactly what I changed, by the way:

diff --git a/mytrigsimp.py b/mytrigsimp.py
index 0b6288d..12715ab 100644
--- a/mytrigsimp.py
+++ b/mytrigsimp.py
@@ -9,15 +9,18 @@ def build_ideal(x, n):
     The main tradeoff here is performance: the more expressions we introduce,
     the slower the simplification process (but the better the
possible results).
     """
-    I = [cos(x)**2 + sin(x)**2 - 1]
-    g = [cos(x), sin(x)]
+    I = [cos(x)**2 + sin(x)**2 - 1, tan(x)*cos(x) - sin(x)]
+    g = [cos(x), sin(x), tan(x)]
     y = Dummy('y')
     for k in range(2, n + 1):
         cn = cos(k*y).expand(trig=True).subs(y, x)
         sn = sin(k*y).expand(trig=True).subs(y, x)
+        tn = tan(k*y).rewrite(cos).expand(trig=True).subs(y, x)
+        tna, tnd = tn.as_numer_denom()
         I.append(cos(k*x) - cn)
         I.append(sin(k*x) - sn)
-        g.extend([cos(k*x), sin(k*x)])
+        I.append(tan(k*x)*tnd - tna)
+        g.extend([cos(k*x), sin(k*x), tan(k*x)])
     return I, g

 def analyse_gens(gens, m):
@@ -228,7 +231,7 @@ def findsol(dic, syms):
     for keys in combinations(dic.keys(), len(free)):
         #print keys
         s = solve([dic[a] for a in keys])
-        if not all(v == 0 for _, v in s.iteritems()):
+        if s and not all(v == 0 for _, v in s.iteritems()):
             poss.append(s)

     if not poss:

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to