2
$\begingroup$

I want to solve an equation in x, containing Sin[x], Cos[x] and a positive real constant b:

Solve[Cos[x] - b Sin[x] == 0 && x > 0 && x < π && b > 0,x]

Mathematica returns

{{x -> ConditionalExpression[-2 ArcTan[b - Sqrt[1 + b^2]], b > 0]}}

If I manually bring Cos[x] to the other side of the equation:

Solve[1 == b Sin[x]/Cos[x] && x > 0 && x < π && b > 0,x]

Mathematica returns

{{x -> ConditionalExpression[ArcTan[1/b], b > 0]}}

which is the solution that I prefer to see (I am aware of the fact that the solutions are equivalent for b > 0).

My question: can I impose conditions on Solve such that it internally rephrases my equation from

Cos[x] - b Sin[x] == 0

to

1 == b Sin[x]/Cos[x]

or can this be performed with other Mathematica commands in advance of using Solve?

$\endgroup$
1
  • 1
    $\begingroup$ Solve[b == First[b /. FullSimplify@Solve[Cos[x] - b Sin[x] == 0 && Pi/2 > x > 0, b]], x] $\endgroup$ – Dr. belisarius Oct 3 '14 at 11:35
1
$\begingroup$

Another approach is to include a double-angle identity in the transformations tried by Simplify:

doubleangle = # /. t_ArcTan :> 1/2 Simplify@ArcTan[TrigExpand@Tan[2 t]] &;

Simplify[
 Solve[Cos[x] - b Sin[x] == 0 && x > 0 && x < π && b > 0, x],
 TransformationFunctions -> {doubleangle, Automatic}]
(*  {{x -> ConditionalExpression[ArcTan[1/b], b > 0]}} *))

One advantage or drawback, according to one's own point of view, is that the form ultimately returned will be the one that Mathematica counts as "simpler." See Simplify, TransformationFunctions and ComplexityFunction.

$\endgroup$
2
$\begingroup$

Belisarus in his comment gave one solution which can be referred to as a post-processing. Here is the pre-processing as you mentioned:

 eq = Cos[x] - b Sin[x] == 0;
Map[Divide[#, Cos[x]] &, eq] // Expand
(*        1 - b Tan[x] == 0           *)

In my version 10, however, your equation is perfectly solved by itself yielding

Solve[eq,x]
  (*   {{x -> ConditionalExpression[
    ArcTan[-(b/Sqrt[1 + b^2]), -(1/Sqrt[1 + b^2])] + 2 \[Pi] C[1], 
    C[1] \[Element] Integers]}, {x -> 
   ConditionalExpression[
    ArcTan[b/Sqrt[1 + b^2], 1/Sqrt[1 + b^2]] + 2 \[Pi] C[1], 
    C[1] \[Element] Integers]}}   *)

The solution refers to any b, while the conditional expression is only related to the fact that C[1]are integers. If you prefer to only work with positive bs you just simplify it

Simplify[Solve[eq, x], b > 0]

(*  {{x -> 
   ConditionalExpression[ArcTan[1/b] + \[Pi] (-1 + 2 C[1]), 
    C[1] \[Element] Integers]}, {x -> 
   ConditionalExpression[ArcTan[1/b] + 2 \[Pi] C[1], 
    C[1] \[Element] Integers]}}
*)

Have fun!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.