Guard against extracting a gcd for symbolic powers.

Fixes issue 4032: trigsimp() TypeError: symbolic boolean expression has no truth value
http://code.google.com/p/sympy/issues/detail?id=4032
Add test from issue 4032.
Merge pull request #2489 from jrioux/relational

Guard against extracting a gcd for symbolic powers.

Fixes issue 4032: trigsimp() TypeError: symbolic boolean expression has no truth value
http://code.google.com/p/sympy/issues/detail?id=4032