Ask Your Question

Commentary on "Simplify trig expressions with the double angle formula"

asked 2018-07-19 12:12:48 +0200

Emmanuel Charpentier gravatar image

updated 2018-07-19 12:13:54 +0200

A bit of reflexion leads me to propose a "brute force" answer to a question wher the answer could be divined with a bit of "intuition".

The original question was :

I am trying to simplify the following expression in sage:


the resulting expression should be:

2/3*cos(pi/6-x) .simplify_full(), trig_reduce(), or simplify_trig() cannot produce this simplification.

Is sage currently capable of doing this?

See below for the steps of the solution. Comments, criticisms and even lazzi welcome...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-19 12:43:59 +0200

Emmanuel Charpentier gravatar image

The original expression is of the form $a\cos x + b\sin x$. if it turns out that $a^2+b^2=1$, we can rewrite this as either $\sin(x+y)$ or $\cos(x+y)$, which will give us a solution. So, let's factor out a constant leaving the sum of squares of the coeffs of trig_function(x) at 1 :

k=sum([f.coefficient(g(x),1)^2 for g in [sin,cos]]).sqrt()
print k


Now that this is out of the way, let's search systematically :

L1=[fr.coefficient(g(x),1)==h.coefficient(g(x),1) for g in [sin,cos]]
print L1

[(1/2) == cos(y), 1/2*sqrt(3) == sin(y)]

print solve(L1,y)

[[y == 1/3pi + 2pi*z388]]

Check that solution :



One notes with interest that this check does not require the specification of the free integer constant z248.


L2=[fr.coefficient(g(x),1)==h.coefficient(g(x),1) for g in [sin,cos]]
print solve(L2,y)

[[y == -1/6pi + 2pi*z402]]



This second expression is the "original" sought solution.

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


Asked: 2018-07-19 12:12:48 +0200

Seen: 233 times

Last updated: Jul 19 '18