Ask Your Question
3

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

asked 2018-12-03 04:22:20 +0100

sagenovice gravatar image

updated 2018-12-03 05:20:51 +0100

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-12-03 16:49:22 +0100

Emmanuel Charpentier gravatar image

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)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-12-03 04:22:20 +0100

Seen: 415 times

Last updated: Dec 03 '18