Parity and symmetry each refer to any one of several related notions, including: Parity
Symmetry and skew-symmetry
Symmetric and skew-symmetric parts Each has the specified property, and their sum equals the function from which they are derived. For example, sinh and cosh are the odd and even parts of the exponential under negation. In classifying any entity for parity or symmetry, we will give the result _1 for the odd or skew case, 1 for the even or symmetric case, and 0 for neither.
The symmetry of a function may be tested (but not guaranteed) by the adverb a3 : |
+/a3 +/ -: +/@(?@!@# A. ]) (+/a3,-/a3,*/a3,>./a3,/:~a3) 3 1 4 2 1 0 1 1 1 Sum, product over, max over, and grade are symmetric, but the alternating sum is not.
Phrases may be analyzed by isolating and executing phrases that occur within them. Consider, for example, phrases m4-7: |
p6=: (i.@! A. i.) 3 n6=: 3 3 3#:i.6 p6 ; (,. m4"1 p6) ; n6 ; (,. m4"1 n6) +----------------+ ¦0 1 2¦ 1¦0 0 0¦0¦ ¦0 2 1¦_1¦0 0 1¦0¦ ¦1 0 2¦_1¦0 0 2¦0¦ ¦1 2 0¦ 1¦0 1 0¦0¦ ¦2 0 1¦ 1¦0 1 1¦0¦ ¦2 1 0¦_1¦0 1 2¦1¦ +----------------+ perm=: 3 1 4 2 0 (L;R;(L*R);(L C R)) perm +-------------------------------+ ¦0 1 0 1 1¦0 1 1 1 1¦0 1 0 1 1¦1¦ ¦0 0 0 0 1¦0 0 1 1 1¦0 0 0 0 1¦ ¦ ¦1 1 0 1 1¦0 0 0 1 1¦0 0 0 1 1¦ ¦ ¦0 1 0 0 1¦0 0 0 0 1¦0 0 0 0 1¦ ¦ ¦0 0 0 0 0¦0 0 0 0 0¦0 0 0 0 0¦ ¦ +-------------------------------+
These panels show that L compares every pair of elements of the argument for precedence (to see which must be moved over which), and the upper triangle provided by R masks out double counting. Used with various functions such as negate and transpose, the conjunctions .: and .. yield adverbs that produce odd and even parts of functions to which they are applied:
|
(^skn,sinh,^syn,cosh,: ^ = ^skn + ^syn) a=:i.6 0 1.1752 3.62686 10.0179 27.2899 74.2032 0 1.1752 3.62686 10.0179 27.2899 74.2032 1 1.54308 3.7622 10.0677 27.3082 74.2099 1 1.54308 3.7622 10.0677 27.3082 74.2099 1 1 1 1 1 1 ]y=: (^t. , ^skn t. , sinh t. , ^syn t. ,: cosh t.) a 1 1 0.5 0.1666667 0.04166667 0.008333333 0 1 0 0.1666667 0 0.008333333 0 1 0 0.1666667 0 0.008333333 1 0 0.5 0 0.04166667 0 1 0 0.5 0 0.04166667 0 % y 1 1 2 6 24 120 _ 1 _ 6 _ 120 _ 1 _ 6 _ 120 1 _ 2 _ 24 _ 1 _ 2 _ 24 _ !^:_1 % y 0 0 2 3 4 5 _ 0 _ 3 _ 5 _ 0 _ 3 _ 5 0 _ 2 _ 4 _ 0 _ 2 _ 4 _ (L;L skt;L syt;L skt+L syt) m +----------------------------------------------+ ¦15 19 21¦_5.5 _3.5 5¦20.5 22.5 16¦15 19 21¦ ¦11 22 13¦_7.5 _3.5 3¦18.5 25.5 10¦11 22 13¦ ¦12 5 25¦ 0.5 _1 3.5¦11.5 6 21.5¦12 5 25¦ +----------------------------------------------+
Skew arrays may be used in expressions for orthogonality, as in the vector cross product (orthogonal to the plane defined by its arguments), the curl (orthogonal to the matrix of partial derivatives), and the determinant. We will illustrate this by the completely skew tensor (cst), whose sign is reversed by the transposition of any pair of axes.
|
v=: a cross1 b [a=: 3 1 4 [ b=: 2 0 5 v;(v ip a,.b);(a angle b);(dfr 0 0 1 angle 0 1 0) +-----------------------+ �_5 7 2�0 0�0.3274544�90� +-----------------------+ (cst@#;*//;(cst@#**//);+/@,@(cst@#**//);det1) m +----------------------------------+ � 0 0 0� 6 24 6�0 0 0�_25�_25� � 0 0 1� 0 0 0�0 0 0� � � � 0 _1 0�15 60 15�0 _60 0� � � � � � � � � � 0 0 _1� 2 8 2�0 0 _2� � � � 0 0 0� 0 0 0�0 0 0� � � � 1 0 0� 5 20 5�5 0 0� � � � � � � � � � 0 1 0� 8 32 8�0 32 0� � � �_1 0 0� 0 0 0�0 0 0� � � � 0 0 0�20 80 20�0 0 0� � � +----------------------------------+