Ask Your Question
1

How to simplify 1-cos(u)^2.

asked 2017-06-21 09:36:32 +0100

ablmf gravatar image

I have tried

sage: assume(0<u<pi/2)

But I still get

sage: simplify(1-cos(u)^2)
-cos(u)^2 + 1
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2017-06-21 10:46:43 +0100

ndomes gravatar image

There are far more simplify methods. expr.simplify? gives a hint:

See also: "simplify_full()", "simplify_trig()", "simplify_rational()", "simplify_rectform()", "simplify_factorial()", "simplify_log()", "simplify_real()", "simplify_hypergeometric()", "canonicalize_radical()"

In this case simplify_trig will do the job.

var('u')
expr = 1-cos(u)^2
expr.simplify_trig()
edit flag offensive delete link more
2

answered 2017-06-21 19:29:38 +0100

dan_fulea gravatar image

Note that sometimes the "degree reduction" (of the involved trigonometric polynomial) is the wanted and/or needed "simplification".

The corresponding method is called reduce_trig.

The following sample code shows some differences.

sage: var('u');
sage: a = 1 - cos(u)^2
sage: a.simplify_trig()
sin(u)^2
sage: a.reduce_trig()
-1/2*cos(2*u) + 1/2
sage: a.simplify_trig().reduce_trig()
-1/2*cos(2*u) + 1/2
sage: a.reduce_trig().simplify_trig()
sin(u)^2

With an other example...

sage: b = sin(u)^4 - cos(u)^4
sage: b.simplify_trig()
-2*cos(u)^2 + 1
sage: b.reduce_trig()
-cos(2*u)
edit flag offensive delete link more
1

answered 2017-06-21 15:30:29 +0100

calc314 gravatar image

Just for completeness -- another option is to use sympy. See http://docs.sympy.org/latest/tutorial/simplification.html for some simplification options.

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: 2017-06-21 09:36:32 +0100

Seen: 557 times

Last updated: Jun 21 '17