Yesterday I ran into some trouble when trying to integrate a simple
integral that should return atan(x). I also found an open bug about
this topic: http://code.google.com/p/sympy/issues/detail?id=636&q=atan
.

So, I took a peek into sympy/simplify/simplify.py's trigsimp function.
So I tried to add the specific form with imaginary units into matchers
list under ifelse expr.is_Add but it doesn't seem to work :(

diff --git a/sympy/simplify/simplify.py b/sympy/simplify/simplify.py
index b2816f3..916e608 100644
--- a/sympy/simplify/simplify.py
+++ b/sympy/simplify/simplify.py
@@ -762,11 +762,16 @@ def trigsimp(expr, deep=False):
         log(2)
     """
     from sympy.core.basic import S
-    sin, cos, tan, cot = C.sin, C.cos, C.tan, C.cot
+    from sympy import log
+    I = S.ImaginaryUnit
+    sin, cos, tan, cot, atan = C.sin, C.cos, C.tan, C.cot, C.atan

     #XXX this stopped working:
     if expr == 1/cos(Symbol("x"))**2 - 1:
         return tan(Symbol("x"))**2
+# This works :)
+#    if expr == (((I*log(Symbol("x") + I))/Rational(2) - (I*log(Symbol
("x") - I))/Rational(2))):
+#        return atan(Symbol("x"))

     if expr.is_Function:
         if deep:
@@ -786,7 +791,8 @@ def trigsimp(expr, deep=False):
         matchers = (
             (a*sin(b)**2, a - a*cos(b)**2),
             (a*tan(b)**2, a*(1/cos(b))**2 - a),
-            (a*cot(b)**2, a*(1/sin(b))**2 - a)
+            (a*cot(b)**2, a*(1/sin(b))**2 - a),
+            (((I*log(a)+I)/Rational(2))-((I*log(a)-I)/Rational(2)),
atan(a)),
         )

         # Scan for the terms we need

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

Reply via email to