Bound: Difference between revisions

Jump to navigation Jump to search
65 bytes added ,  22:19, 10 September 2022
m
Text replacement - "</source>" to "</syntaxhighlight>"
Miraheze>Marshall
No edit summary
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The [[bound]] of an array is the number of [[element]]s it contains, or equivalently the length ([[Tally]]) of its [[ravel]] vector or the product (<source lang=apl inline>×/</source>) of its [[shape]].
The [[bound]] of an array is the number of [[element]]s it contains, or equivalently the length ([[Tally]]) of its [[ravel]] vector or the [[product]] of its [[shape]] (<syntaxhighlight lang=apl inline>×/</syntaxhighlight>).


The bound can be derived axiomatically as a function of the [[shape]] from two rules:
The bound can be derived axiomatically as a function of the [[shape]] from two rules:
Line 5: Line 5:
* If two shapes are [[catenate]]d (for instance by an [[outer product]]), the resulting bound is the product of their individual bounds.
* If two shapes are [[catenate]]d (for instance by an [[outer product]]), the resulting bound is the product of their individual bounds.


A scalar has [[rank]] 0, or empty shape. From the above axioms we can deduce that it has bound 1: catenating <source lang=apl inline>⍬</source> with some other shape leaves that shape unchanged, so multiplying any bound by a scalar's bound cannot change it either. Therefore a scalar's bound must be the multiplicative identity, 1.
A scalar has [[rank]] 0, or empty shape. From the above axioms we can deduce that it has bound 1: catenating <syntaxhighlight lang=apl inline>⍬</syntaxhighlight> with some other shape leaves that shape unchanged, so multiplying any bound by a scalar's bound cannot change it either. Therefore a scalar's bound must be the multiplicative identity, 1.


Combining [[Axis|axes]] of an array, for instance by using [[Table]] or [[Ravel]] with [[Function axis|axis]], leaves the array's bound unchanged, despite changing its shape, rank, and possibly [[Tally]].
Combining [[Axis|axes]] of an array, for instance by using [[Table]] or [[Ravel]] with [[Function axis|axis]], leaves the array's bound unchanged, despite changing its shape, rank, and possibly [[Tally]].
{{APL programming language}}
{{APL features}}[[Category:Array characteristics]]

Navigation menu