7594: factor(sqrt(x**2)) != x

logic in factor allowed sqrt(x**2) to become x. This has now been removed.
This breaks some trig manual_integrate results that are fixed in the next
commit.

In keeping with similar simplifications that are made to
spherical harmonic functions (sqrt(sin(theta)**2) -> sin(theta) because
of the assumed range of theta which makes sin(theta) positive), the
pattern sqrt(1-cos(theta)**2) is replaced with the simpler sin(theta),
too.
Impose domain restrictions in trig sub integrals