<
In some applications it is necessary to map an angle to a range of 0 to 360 degrees. Adding 360 degrees to an angle, or subtracting 360 from an angle does not change actually change the angle. One way to do this would be to add (or subtract) enough multiples of 360 degrees until the angle falls between 0 and 360. For example, given an angle of 400 you would subtract 360 to get an angle of 40 degrees. In Maple, this is easily accomplished by the following function.

Frem := (x,y) -> x - y*floor(x/y);

<!--break-->
Here are some examples for positive angles

> Frem (90, 360);
90
> Frem (300, 360);
300
> Frem (400, 360);
40

And some examples for the negative angles.

> Frem (-90, 360);
270
> Frem (-300, 360);
60
> Frem (-400, 360);
320

The same function can be used to map radian angles, i.e.

> Frem (9/4*Pi, 2*Pi);
1/4 Pi






Please Wait...