David Alis wrote:
> Is there a global setting
> that controls the display
> format of complex [as cartesian
> vs polar]?
Kip Murray wrote:
> There is no global setting,
> but you can use monadic *.
Correct, and don't forget the notation 5ar0.927295 (I don't think I've ever
actually seen someone use this before, and always wondered about its
utility; now I know):
*. 5j6 12j13
7.81025 0.876058
17.6918 0.825377
7.81025ar0.876058 17.6918ar0.825377
5j6 12j13
polar =: [: ,@,.&' '"2 (, 'ar'&,)&":/@*.
polar 5j6 12j13
7.81025ar0.876058 17.6918ar0.825377
". polar 5j6 12j13
5j6 12j13
Or, if you prefer your angles in degrees rather than radians, use ad in
place of ar :
polarDeg =: [: ,@,.&' '"2 ((, 'ad'&,)&": %&1r180p1)/@*.
polarDeg 5j6 12j13
7.81025ad50.1944 17.6918ad47.2906
7.81025ad50.1944 17.6918ad47.2906
5j6 12j13
". polarDeg 5j6 12j13
5j6 12j13
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm