sympy/sympy — pull request #7788 by skirpichev (2014-07-25 19:43:22+00:00)
Title: WIP: Fix for #7761, a second attempt

This PR implements a first suggestion by @smichr, see [this](https://github.com/sympy/sympy/pull/7764#issuecomment-50144169).

Everything seems ok, except for a little cryptic failure in test_trigsimp1 (similar test with tan instead of tanh - works).

Fixes #7761.