10
$\begingroup$

Can anyone help me to evaluate the trigonometric function below?
Please look that the picture for more details.

Here is the code to evaluate:

ArcTan[k] + ArcTan[1/k]

From trigonometry we know that $tan^{-1}(k)+tan^{-1}(\frac{1}{k})=\frac{\pi}{2}$. However, when I put input that expression into Mathematica I get this:

$$ArcTan[\frac{1}{k}]+ArcTan[k]$$

Can anyone help me to get the result of $\frac{\pi}{2}$?

$\endgroup$
  • 2
    $\begingroup$ The identity does not hold for negative values of k. $\endgroup$ – Mr.Wizard Dec 24 '16 at 18:40
  • $\begingroup$ So let's assume that k is positive, how to add that condition and simplify to the result of pi/2? $\endgroup$ – anhnha Dec 24 '16 at 18:41
  • $\begingroup$ I tried FullSimplify[ArcTan[k] + ArcTan[1/k], k > 0] but it did not work. I am still looking at this. $\endgroup$ – Mr.Wizard Dec 24 '16 at 18:42
  • $\begingroup$ I've got only that FullSimplify[ArcTan[k] + ArcTan[1/k] == Pi/2, k > 0] yields True; but ArcTan[k] + ArcTan[1/k] /. k -> 137 // FullSimplify (or with any other k) gives Pi/2 (or 1.5708 if k is inexact). $\endgroup$ – corey979 Dec 24 '16 at 18:47
15
$\begingroup$

We know that FullSimplify[ArcTan[k] + ArcTan[1/k], k > 0] does not do it. But by first converting to exponentials, now Mathematica does it

   FullSimplify[ TrigToExp[ArcTan[k] + ArcTan[1/k]] , k > 0]

Gives as output $\frac{\pi}{2}$

$\endgroup$
10
$\begingroup$

This works:

Assuming[k > 0, 
 Solve[FullSimplify[ArcTan[k] + ArcTan[1/k] == x], x]]

(* ==> {{x -> Pi/2}} *)

Here, I equate the expression in the question to a symbol x and ask Mathematica what x is. Inserting an apparently trivial Solve sometimes leads to further simplifications.

In this case, the simplification already occurs in the inner step:

Assuming[k > 0, FullSimplify[ArcTan[k] + ArcTan[1/k] == x]]

(* ==> 2 x == Pi *)

But Solve makes sure that you're getting the result with x on one side of the equation.

Edit: Making it work purely with Simplify:

This is the shortest method I could find:

1/FullSimplify[1/(ArcTan[k] + ArcTan[1/k]), k > 0]

(* ==> Pi/2 *)

So here I just added the operation 1/... to get FullSimplify to do what I want. Then I undo the inverse after the simplification.

$\endgroup$
  • $\begingroup$ Really interesting, what is operation 1/...? I couldn't find it from Wolfram Documentation. $\endgroup$ – anhnha Dec 25 '16 at 1:26
  • $\begingroup$ I just meant the operation of taking the inverse: 1/(ArcTan...) - didn't want to repeat the code. It's not meant to be a secret command with three dots. Although I don't blame you for suspecting as much in a language like Mathematica. $\endgroup$ – Jens Dec 25 '16 at 1:33
  • $\begingroup$ Well, I knew what you meant by three dots but I didn't notice the inverse inside FullSimplify function so I thought 1/... is as a magic command! $\endgroup$ – anhnha Dec 25 '16 at 1:51

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.