User Tools

Site Tools


prime:polrec

This is an old revision of the document!


Polar/Rectangular

Polar coordinates are entered using R∠Angle, where ∠ is Shift-x (multiply). Rectangular coordinates are entered using complex values as in a+b*i (where i is Shift-2). Also useful is the π symbol (shift-3).

In the geometry app you can enter a point in either form using the point() function.

If you enter a polar coordinate as in 1∠(π/4), and hit enter, and then hit the <angle> button again, it'll convert the number to it's rectangular/complex form.

The following function is a useful one to have in your arsenal. It will convert from polar to rectangular and vice versa…automatically. Note that it uses a shortcut for the STRING() function by just doing T:=“”+V; to convert the numerical variable V to a string. (just a useful tip).

EXPORT POLREC(Z) // POLAR/RECT CONVERT
BEGIN
 LOCAL T,A,B;
 T:=""+Z;
 IF INSTRING(T,"∠") THEN
  // POLAR
  A:=RE(Z);
  B:=IM(Z);
  RETURN EXPR(A "+" B*i);
 ELSE
  // RECTANGULAR
  A:=ABS(Z);
  B:=ARG(Z);
  RETURN EXPR(A "" B);
 END // IF...
END // BEGIN
prime/polrec.1508211506.txt.gz · Last modified: 2017/10/16 20:38 by webmasterpdx