Bound: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>Adám Brudzewsky
m (Text replacement - "</code>" to "</source>")
m (Array characteristics category)
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The [[bound]] of an array is the number of [[elements]] 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 (<source lang=apl inline>×/</source>) of its [[shape]].


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:
* The bound of a [[vector]] is its length, and
* The bound of a [[vector]] is its length, and
* If two shapes are [[Catenate|catenated]] (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 <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.


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 features}}[[Category:Array characteristics]]

Revision as of 14:18, 30 April 2020

The bound of an array is the number of elements it contains, or equivalently the length (Tally) of its ravel vector or the product (×/) of its shape.

The bound can be derived axiomatically as a function of the shape from two rules:

  • The bound of a vector is its length, and
  • If two shapes are catenated (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 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 axes of an array, for instance by using Table or Ravel with axis, leaves the array's bound unchanged, despite changing its shape, rank, and possibly Tally.

APL features [edit]
Built-ins Primitives (functions, operators) ∙ Quad name
Array model ShapeRankDepthBoundIndex (Indexing) ∙ AxisRavelRavel orderElementScalarVectorMatrixSimple scalarSimple arrayNested arrayCellMajor cellSubarrayEmpty arrayPrototype
Data types Number (Boolean, Complex number) ∙ Character (String) ∙ BoxNamespaceFunction array
Concepts and paradigms Conformability (Scalar extension, Leading axis agreement) ∙ Scalar function (Pervasion) ∙ Identity elementComplex floorArray ordering (Total) ∙ Tacit programming (Function composition, Close composition) ∙ GlyphLeading axis theoryMajor cell search
Errors LIMIT ERRORRANK ERRORSYNTAX ERRORDOMAIN ERRORLENGTH ERRORINDEX ERRORVALUE ERROREVOLUTION ERROR