Identity element: Difference between revisions

Jump to navigation Jump to search
687 bytes added ,  14:23, 14 July 2020
m
Text replacement - "http://help.dyalog.com" to "https://help.dyalog.com"
Miraheze>Adám Brudzewsky
(Created page with "The '''identity element''' for a dyadic function is a value inherent to that function. It is defined as the value which would preserve the ''other'' argument of the dyadic...")
 
m (Text replacement - "http://help.dyalog.com" to "https://help.dyalog.com")
(10 intermediate revisions by 5 users not shown)
Line 4: Line 4:


Since the identity element preserves the ''other'' argument, it can be a left and/or a right identity. For example, [[Add]] (<source lang=apl inline>+</source>) has the left and right identity element <source lang=apl inline>0</source> because <source lang=apl inline>N≡N+0</source> and <source lang=apl inline>N≡0+N</source> for all arrays <source lang=apl inline>N</source> in the domain of <source lang=apl inline>+</source>. However, the identity of [[Divide]] (<source lang=apl inline>÷</source>), <source lang=apl inline>1</source>, is only a right identity because while <source lang=apl inline>N≡N÷1</source> is true for all <source lang=apl inline>N</source> in the domain of <source lang=apl inline>÷</source>, this isn't so for <source lang=apl inline>N≡1÷N</source>, and no alternative identity element value exists which would fulfil the condition.
Since the identity element preserves the ''other'' argument, it can be a left and/or a right identity. For example, [[Add]] (<source lang=apl inline>+</source>) has the left and right identity element <source lang=apl inline>0</source> because <source lang=apl inline>N≡N+0</source> and <source lang=apl inline>N≡0+N</source> for all arrays <source lang=apl inline>N</source> in the domain of <source lang=apl inline>+</source>. However, the identity of [[Divide]] (<source lang=apl inline>÷</source>), <source lang=apl inline>1</source>, is only a right identity because while <source lang=apl inline>N≡N÷1</source> is true for all <source lang=apl inline>N</source> in the domain of <source lang=apl inline>÷</source>, this isn't so for <source lang=apl inline>N≡1÷N</source>, and no alternative identity element value exists which would fulfil the condition.
If a function <source lang=apl inline>f</source> has both a left identity element and a right identity element (call them <source lang=apl inline>l</source> and <source lang=apl inline>r</source>), then they must be the same. This is because <source lang=apl inline>l f r</source> {{←→}} <source lang=apl inline>r</source>, since <source lang=apl inline>l</source> is a left identity, and <source lang=apl inline>l f r</source> {{←→}} <source lang=apl inline>l</source>, since <source lang=apl inline>r</source> is a right identity, so <source lang=apl inline>l</source> {{←→}} <source lang=apl inline>r</source>.


== Reduction over a length-0 axis ==
== Reduction over a length-0 axis ==
Line 39: Line 41:
| [[Power]] || <source lang=apl inline>*</source> || <source lang=apl inline>1</source> || {{No}} || {{Yes}} ||
| [[Power]] || <source lang=apl inline>*</source> || <source lang=apl inline>1</source> || {{No}} || {{Yes}} ||
|-
|-
| [[Circular]] || <source lang=apl inline>○</source> || <source lang=apl inline>¯9</source> || {{Yes}} || {{No}} ||  
| [[Circle function]] || <source lang=apl inline>○</source> || <source lang=apl inline>¯9</source> || {{Yes}} || {{No}} ||  
|-
|-
| [[Binomial]] || <source lang=apl inline>!</source> || <source lang=apl inline>1</source> || {{Yes}} || {{No}} ||
| [[Binomial]] || <source lang=apl inline>!</source> || <source lang=apl inline>1</source> || {{Yes}} || {{No}} ||
Line 45: Line 47:
| [[Root]] || <source lang=apl inline>√</source> || <source lang=apl inline>1</source> || {{Yes}} || {{No}} ||
| [[Root]] || <source lang=apl inline>√</source> || <source lang=apl inline>1</source> || {{Yes}} || {{No}} ||
|-
|-
| [[And]]/[[LCM]] || <source lang=apl inline>∧</source> || <source lang=apl inline>0</source> || {{Yes}} || {{Yes}} ||
| [[And]]/[[LCM]] || <source lang=apl inline>∧</source> || <source lang=apl inline>1</source> || {{Yes}} || {{Yes}} ||
|-
|-
| [[Or]]/[[GCD]] || <source lang=apl inline>∨</source> || <source lang=apl inline>1</source> || {{Yes}} || {{Yes}} ||
| [[Or]]/[[GCD]] || <source lang=apl inline>∨</source> || <source lang=apl inline>0</source> || {{Yes}} || {{Yes}} || Non-negative reals only
|-
|-
| [[Less]] || <source lang=apl inline><</source> || <source lang=apl inline>0</source> || {{Yes}} || {{No}} || [[Boolean]]s only
| [[Less]] || <source lang=apl inline><</source> || <source lang=apl inline>0</source> || {{Yes}} || {{No}} || [[Boolean]]s only
Line 77: Line 79:
| [[Take]] || <source lang=apl inline>↑</source> || <source lang=apl inline>⍬</source> or <source lang=apl inline>⍴P</source>|| {{Yes}} || {{No}} ||
| [[Take]] || <source lang=apl inline>↑</source> || <source lang=apl inline>⍬</source> or <source lang=apl inline>⍴P</source>|| {{Yes}} || {{No}} ||
|-
|-
| [[Squad Indexing]] || <source lang=apl inline>⌷</source> || <source lang=apl inline>⍬</source> or <source lang=apl inline>⍳¨⍴P</source>|| {{Yes}} || {{No}} ||
| [[Squad Index]] || <source lang=apl inline>⌷</source> || <source lang=apl inline>⍬</source> or <source lang=apl inline>⍳¨⍴P</source>|| {{Yes}} || {{No}} ||
|-
|-
| [[Without]] || <source lang=apl inline>~</source> || <source lang=apl inline>0⌿P</source> || {{Yes}} || {{Yes}} || <source lang=apl inline>1≤≢⍴Y</source>
| [[Without]] || <source lang=apl inline>~</source> || <source lang=apl inline>0⌿P</source> || {{No}} || {{Yes}} || <source lang=apl inline>1≤≢⍴Y</source>
|-
|-
| [[Matrix Divide]] || <source lang=apl inline>⌹</source> || <source lang=apl inline>∘.=⍨⍳≢P</source> || {{No}} || {{Yes}} ||
| [[Matrix Divide]] || <source lang=apl inline>⌹</source> || <source lang=apl inline>∘.=⍨⍳≢P</source> || {{No}} || {{Yes}} ||
Line 98: Line 100:
== External links ==
== External links ==


* [[wikipedia:Identity element|Wikipedia]]
* [[wikipedia:Identity element|Identity element]]


=== Documentation ===
=== Documentation ===


* [http://help.dyalog.com/latest/#Language/Primitive%20Operators/Reduce.htm Dyalog APL]
* [https://help.dyalog.com/latest/#Language/Primitive%20Operators/Reduce.htm Dyalog APL]


* [https://www.ibm.com/downloads/cas/ZOKMYKOY#page=227 APL2]
* [https://www.ibm.com/downloads/cas/ZOKMYKOY#page=227 APL2]


{{APL programming language}}
{{APL features}}[[Category:Function characteristics]]

Navigation menu