0
$\begingroup$

When using FunctionRange to compute the range of the two-argument ArcTan function, Mathematica fails to return an exact answer.

FunctionRange[ArcTan[x, y], {x, y}, t]

(*FunctionRange::nopt: Unable to find the exact range. Returning bounds on the range computed using numeric optimization methods.*)

(*-3.14159 <= t <= 3.14159*)

I observe that one can use ComplexExpand to turn two-argument ArcTan into the complex Arg function, but this doesn't seem to help, as in that case it stays unevaluated after throwing a message.

ArcTan[x, y] // ComplexExpand

(*Arg[x + I y]*)

FunctionRange[Arg[z], z, t, Complexes]

(*FunctionRange::nmet: Unable to find the range with the available methods.*)

(*FunctionRange[Arg[z], z, t, Complexes]*)

It would be convenient for me to have a generic method that wouldn't require me to "cheat" by supplying the range of ArcTan manually. I carefully read the documentation for the functions involved, but wasn't able to deduce the right way to proceed. Any help appreciated!

$\endgroup$
3
  • 2
    $\begingroup$ FunctionRange[ArcTan[x, y], {x, y}, t, Method -> {"Reduced" -> True}] gives an exact answer, although I can't say like it. $\endgroup$
    – Michael E2
    Commented Oct 7 at 1:28
  • $\begingroup$ Thanks for the observation. That is rather ugly. I'll see if I can find a way to coerce that into something usable. $\endgroup$ Commented Oct 7 at 1:33
  • $\begingroup$ Reduce[ArcTan[x, y] == -Pi, {x, y}, Reals] results in False so the range is t>-Pi&&t<=Pi. $\endgroup$
    – user64494
    Commented Nov 6 at 9:25

1 Answer 1

0
$\begingroup$

It was noted that FunctionRange can give an exact answer, but in a very complex form that I wasn't able to manipulate fruitfully. In the absence of a better solution, I employed the following function to recognize explicit numerical pi up to a tolerance.

recognizePi[expr_] :=
 expr /.
  x_Real /; Abs[x] - Pi < 10^-10 :>
   Sign[x]*Pi

FunctionRange[ArcTan[x, y], {x, y}, t] // Quiet // recognizePi

(* -π <= t <= π *)
$\endgroup$
3
  • 1
    $\begingroup$ FunctionRange[ArcTan[x, y], {x, y}, t] /. r_Real :> RootApproximant[r/Pi]*Pi will also handle multiples of Pi $\endgroup$
    – Bob Hanlon
    Commented Oct 7 at 23:16
  • $\begingroup$ Thank you very much! That is much better. $\endgroup$ Commented Oct 8 at 3:52
  • $\begingroup$ Unfortunately, Reduce[ArcTan[x, y] == -Pi, {x, y}, Reals] results in False. $\endgroup$
    – user64494
    Commented Nov 6 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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