Processing math: 100%
Ask Your Question
1

Trigonometric equation

asked 4 years ago

Piotrasz gravatar image

updated 4 years ago

The following code

sage: solve([tan(x) + tan(2*x) - tan(3*x) == 0], x, to_poly_solve='force')

outputs an empty list. How to solve this?

Preview: (hide)

Comments

Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 4 years ago )
1

Use solve([tan(x) + tan(2*x) - tan(3*x) == 0], x, to_poly_solve='force', algorithm='sympy')

FrédéricC gravatar imageFrédéricC ( 4 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 4 years ago

Emmanuel Charpentier gravatar image

FredericC's answer is valid ; it just express the results in terms of sympyobjects with (currently) no automatic sage translation. A solution can be obtained in sage terms by simple transformations :

var("x, t, k")
assume(k, "integer")
Ex=tan(x)+tan(2*x)+tan(3*x)

This expression is a rational fraction in tanx, which we re-express as a rational fraction in t :

sage: ExT
2*(2*t^2 - 1)*(t^2 - 3)*t/((3*t^2 - 1)*(t + 1)*(t - 1))
ExT=Ex.trig_expand().factor().subs(tan(x)==t)

The roots of this fraction are the roots of its numerator...

MR=[u[0].radical_expression()
    for u in ExT.numerator().roots(x==t, ring=QQbar)]

... provided that none of these roots nullifies the denominator :

sage: any([ExT.denominator().subs(t==u).is_zero() for u in MR])
False

The properties of tan ensure us that if x is a solution, so is x+kπ,kZ. Similarly, it is easy to check that if x is a solution, so is πx.

Sol=union([k*pi+arctan(u) for u in MR],[k*pi-arctan(u) for u in MR])
sage: Sol
[-1/3*pi + pi*k,
 pi*k,
 pi*k - arctan(1/2*sqrt(2)),
 1/3*pi + pi*k,
 pi*k + arctan(1/2*sqrt(2))]

FWIW, Mathematica proposes (using only the 2π periodicity of tan, not π...) :

sage: mathematica.Solve(Ex==0,x)
{{x -> ConditionalExpression[2*Pi*C[1], Element[C[1], Integers]]}, 
 {x -> ConditionalExpression[(-2*Pi)/3 + 2*Pi*C[1], 
    Element[C[1], Integers]]}, 
 {x -> ConditionalExpression[-Pi/3 + 2*Pi*C[1], Element[C[1], Integers]]}, 
 {x -> ConditionalExpression[Pi/3 + 2*Pi*C[1], Element[C[1], Integers]]}, 
 {x -> ConditionalExpression[(2*Pi)/3 + 2*Pi*C[1], Element[C[1], Integers]]}, 
 {x -> ConditionalExpression[Pi + 2*Pi*C[1], Element[C[1], Integers]]}, 
 {x -> ConditionalExpression[-ArcTan[1/Sqrt[2]] + 2*Pi*C[1], 
    Element[C[1], Integers]]}, 
 {x -> ConditionalExpression[Pi - ArcTan[1/Sqrt[2]] + 2*Pi*C[1], 
    Element[C[1], Integers]]}, 
 {x -> ConditionalExpression[ArcTan[1/Sqrt[2]] + 2*Pi*C[1], 
    Element[C[1], Integers]]}, 
 {x -> ConditionalExpression[-Pi + ArcTan[1/Sqrt[2]] + 2*Pi*C[1], 
    Element[C[1], Integers]]}}

HTH,

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

Seen: 764 times

Last updated: Jan 12 '21