There have been several approaches discussed on this topic, but I wanted something that would most closely approach the on-key method used on the older calculators such as the HP 33s, where you enter the two values and the result is shown directly on the screen. The best way IMO is to create the output result as a complex number pair. The programs are as follows:

EXPORT Rect_to_Polar(X1,X2)

BEGIN

LOCAL CRP,CIP,CTOT;

CRP:=(X1^2+X2^2)^.5;

CIP:=ATAN(X2/X1);

CTOT:=(CRP,CIP);

RETURN CTOT;

END;

EXPORT Polar_to_Rect(X1,X2)

BEGIN

LOCAL CRP,CIP,CTOT;

CRP:=X1*COS(X2);

CIP:=X1*SIN(X2);

CTOT:=(CRP,CIP);

RETURN CTOT;

END;

To execute from either the Home or CAS screen, select the program from the Toolbox User menu, and enter the values. For example, to convert X=3 and Y=4 in rectangular form to polar, execute Rect_to_Polar as follows:

Rect_to_Polar(3,4) Enter ---> (5.0000,53.1301)

This is assuming complex numbers displayed as (a,b), angular mode in degrees and number format set as Fixed 4.