Message Boards Message Boards

0
|
3334 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Transforming an angle into [-Pi, Pi)

Posted 2 years ago

I have a strange problem with the Mod-function when used for transforming any angle \[Omega] into the half-open interval [-\[Pi], \[Pi]). This is done by Mod[\[Omega], 2 \[Pi], -\[Pi]]:

Plot[Mod[\[Omega], 2 \[Pi], -\[Pi]], {\[Omega], -3 \[Pi], 3 \[Pi]}]

enter image description here

This transformation does not work without error at the bounds [Omega] = ..., -360°, -180°, 180°, 360°, ... Instead, we have to use:

If[ [Omega] == [Pi] Floor[N[ [Omega] / [Pi] ]], -[Pi], Mod[ [Omega] ,2 [Pi] , -[Pi] ] ]

For details, see this attached notebook "220109 Transforming an Angle.nb".

Note: This was done with Wolfram desktop version 13.0.0, but happens as well with version 12.3.1 and version 12.0.0 on Windows 10 Pro (64 bit).

Attachments:
POSTED BY: Werner Geiger
5 Replies
Posted 2 years ago

Sorry, I had a minor error within my code. The correction must read: $\text{If}[\omega \neq 0\land \omega =\pi Floor[ N[\omega/\pi] ] ,-\pi ,\text{Mod}[\omega ,2 \pi ,-\pi]]$

I had forgotten the case $\omega =0$.

For details, see the attached slightly changed notebook "220109b Transforming an Angle.nb".

Attachments:
POSTED BY: Werner Geiger
Posted 2 years ago

BTW: How can I write or copy special characters like Pi into the community editor?

POSTED BY: Werner Geiger
Posted 2 years ago

It is mentioned in READ FIRST. Example:

Evaluate TexForm with the expression as argument

TeXForm[\[Omega] == \[Pi] Floor[N[\[Omega]/\[Pi]]] // HoldForm]
(* \omega =\pi  \left\lfloor N\left[\frac{\omega }{\pi }\right]\right\rfloor *)

Copy the output and paste it in the editor, bracketed between $

$\omega =\pi \left\lfloor N\left[\frac{\omega }{\pi }\right]\right\rfloor$

POSTED BY: Hans Milton
Posted 2 years ago

Thanks Hans. I didn't remember that.

POSTED BY: Werner Geiger

Hi Werner,
You can also use this tool for special characters
http://steampiano.net/msc/

POSTED BY: Ahmed Elbanna
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract