Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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 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?

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 eric_gthe hint for the hint) ) but I 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?

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 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?