Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
-1

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

asked 6 years ago

Emmanuel Charpentier gravatar image

updated 6 years ago

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:

(sqrt(3)/3cos(x)+1/3sin(x))

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 6 years ago

Emmanuel Charpentier gravatar image
var("x,y,k")
f=(sqrt(3)/3*cos(x)+1/3*sin(x))

The original expression is of the form acosx+bsinx. if it turns out that a2+b2=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

2/3

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

fr=f/k
h1=sin(x+y).trig_expand()
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 :

bool(fr.subs(solve(L1,y)[0])*k==f)

True

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

Similarly:

h2=cos(x+y).trig_expand()
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]]

bool(fr.subs(solve(L2,y)[0])*k==f)

True

This second expression is the "original" sought solution.

Preview: (hide)
link

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: 6 years ago

Seen: 333 times

Last updated: Jul 19 '18