Ask Your Question

Trigonometric equation

asked 2021-01-11 15:45:42 +0100

Piotrasz gravatar image

updated 2021-01-11 23:50:25 +0100

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?

edit retag flag offensive close merge delete


Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 2021-01-11 18:39:07 +0100 )edit

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 ( 2021-01-11 18:43:37 +0100 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-01-12 15:27:06 +0100

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")

This expression is a rational fraction in $\tan x$, 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))

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

    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])

The properties of $\tan$ ensure us that if $x$ is a solution, so is $x+k\pi,\, k\in\mathbb{Z}$. Similarly, it is easy to check that if $x$ is a solution, so is $\pi-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 - arctan(1/2*sqrt(2)),
 1/3*pi + pi*k,
 pi*k + arctan(1/2*sqrt(2))]

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

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]]}}


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: 2021-01-11 15:45:42 +0100

Seen: 364 times

Last updated: Jan 12 '21