# Sage doesn't simplify a fraction if it's multiplied by 2

Hello, for some reason sage doesn't simplify a trigonometric expression:

sage: ( 2 * (1-cos(x)) / sqrt(1-cos(x)) ).simplify_full()
-2*(cos(x) - 1)/sqrt(-cos(x) + 1)


while I'd expect sqrt(1-cos(x)).

I also tried a nice simplify_chain_real function (thanks eric_g for the hint) but I've got the same result:

sage: from sage.manifolds.utilities import simplify_chain_real
sage: simplify_chain_real( 2 * (1-cos(x)) / sqrt(1-cos(x)) )
-2*(cos(x) - 1)/sqrt(-cos(x) + 1)


The weird thing is that it works without the 2* part:

sage: ( (1-cos(x)) / sqrt(1-cos(x)) ).simplify_full()
sqrt(-cos(x) + 1)


And even replacing - with + makes it working:

sage: ( 2*(1+cos(x))/sqrt(1+cos(x)) ).simplify_full()
2*sqrt(cos(x) + 1)


I mean, obviously, it can do that kind of simplification. But I can't make it simplify the 2*(1-cos(x))/sqrt(1-cos(x)) expression. What do I miss?

edit retag close merge delete

Sort by » oldest newest most voted

Probable maxima idiosyncrasy :

sage: E=2*(1-cos(x))/sqrt(1-cos(x))
sage: E.simplify_full()
-2*(cos(x) - 1)/sqrt(-cos(x) + 1)
sage: (E/2).simplify_full()*2
2*sqrt(-cos(x) + 1)
sage: import sympy
sage: sympy.sympify(E).simplify()._sage_()
2*sqrt(-cos(x) + 1)

more