Ask Your Question

# simplify_trig and sorting, for example in fractions

The output of

show((1-cos(x)^2.simplify_trig())
show((cos(x)^2-1).simplify_trig())


is

sin(x)^2
cos(x)^2-1.


Even worse, the result of

 (sin(x)^2/(1-cos(x)^2)).simplify().simplify_trig()


is

 -(sin(x)^2/(cos(x)^2-1)


when it should be 1. Is there anyway to get sagemath to simplify trigonometric expressions more intelligently?

edit retag close merge delete

## 1 Answer

Sort by » oldest newest most voted

Works for me (Sagemath 8.7):

sage: (cos(x)^2-1).simplify_trig()
-sin(x)^2


similarly :

sage: (sin(x)^2/(1-cos(x)^2)).simplify().simplify_trig()
1
sage: (sin(x)^2/(1-cos(x)^2)).simplify_trig()
1


Note that:

sage: (cos(x)^2-1).trig_reduce()
1/2*cos(2*x) - 1/2


might be more useful...

What are you using ?

more

## Comments

I upgraded to sagemath 8.6 (the latest version with binaries available for my system), and this now works. Thanks for pointing out to use newer versions.

## Your Answer

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

Add Answer

## Stats

Asked: 2019-03-24 12:55:31 +0200

Seen: 100 times

Last updated: Mar 24 '19