4
$\begingroup$

Is there any built-in Mathematica function that wraps any angle in rad to the $[0,2\pi]$ domain?

So, for example:

wrapTo2pi[9Pi/4]=Pi/4

I know such function exists in Matlab.

Extend: how to wrap any number to a given domain? like wrap A into $[B,C]$

$\endgroup$
9
$\begingroup$
wrapTo2pi[x_] := Mod[x, 2 Pi]
wrapTo2pi[9 Pi/4]
| improve this answer | |
$\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.