Reciprocal (÷
) is a monadic scalar function which gives the multiplicative inverse of a real or complex number. Reciprocal shares the glyph ÷
with the dyadic arithmetic function Divide.
Examples
÷1 2 3 4 5
1 0.5 0.3333333333 0.25 0.2
÷¯2 0.5 1J2
¯0.5 2 0.2J¯0.4
÷0
DOMAIN ERROR: Divide by zero
÷0
∧
⎕DIV←1 ⍝ this sets division by 0 to always return 0
÷0
0
Properties
Reciprocal of any real or complex number is equal to 1 divided by that number. Therefore the monadic ÷
can be seen as dyadic ÷
with default left argument of 1. This applies even to the reciprocal of 0; ÷0
and 1÷0
show identical behavior for both ⎕DIV←0
(raising DOMAIN ERROR) and ⎕DIV←1
(returning 0).
÷1 2 3 4 5
1 0.5 0.3333333333 0.25 0.2
1÷1 2 3 4 5
1 0.5 0.3333333333 0.25 0.2
For any non-zero real or complex numbers, the signum of reciprocal is equal to the conjugate of signum, and the magnitude of reciprocal is equal to the reciprocal of magnitude.
(×∘÷ ≡ +∘×)1 2 3 ¯2 0.5 1J2
1
(|∘÷ ≡ ÷∘|)1 2 3 ¯2 0.5 1J2
1
External links
Documentation
APL built-ins [edit]
|
Primitives (Timeline) |
Functions
|
Scalar
|
Monadic
|
Conjugate ∙ Negate ∙ Signum ∙ Reciprocal ∙ Magnitude ∙ Exponential ∙ Natural Logarithm ∙ Floor ∙ Ceiling ∙ Factorial ∙ Not ∙ Pi Times ∙ Roll ∙ Type ∙ Imaginary ∙ Square Root ∙ Round
|
Dyadic
|
Add ∙ Subtract ∙ Times ∙ Divide ∙ Residue ∙ Power ∙ Logarithm ∙ Minimum ∙ Maximum ∙ Binomial ∙ Comparison functions ∙ Boolean functions (And, Or, Nand, Nor) ∙ GCD ∙ LCM ∙ Circular ∙ Complex ∙ Root
|
Non-Scalar
|
Structural
|
Shape ∙ Reshape ∙ Tally ∙ Depth ∙ Ravel ∙ Enlist ∙ Table ∙ Catenate ∙ Reverse ∙ Rotate ∙ Transpose ∙ Raze ∙ Mix ∙ Split ∙ Enclose ∙ Nest ∙ Cut (K) ∙ Pair ∙ Link ∙ Partitioned Enclose ∙ Partition
|
Selection
|
First ∙ Pick ∙ Take ∙ Drop ∙ Unique ∙ Identity ∙ Stop ∙ Select ∙ Replicate ∙ Expand ∙ Set functions (Intersection ∙ Union ∙ Without) ∙ Bracket indexing ∙ Index ∙ Cartesian Product ∙ Sort
|
Selector
|
Index generator ∙ Grade ∙ Index Of ∙ Interval Index ∙ Indices ∙ Deal ∙ Prefix and suffix vectors
|
Computational
|
Match ∙ Not Match ∙ Membership ∙ Find ∙ Nub Sieve ∙ Encode ∙ Decode ∙ Matrix Inverse ∙ Matrix Divide ∙ Format ∙ Execute ∙ Materialise ∙ Range
|
Operators |
Monadic
|
Each ∙ Commute ∙ Constant ∙ Replicate ∙ Expand ∙ Reduce ∙ Windowed Reduce ∙ Scan ∙ Outer Product ∙ Key ∙ I-Beam ∙ Spawn ∙ Function axis ∙ Identity (Null, Ident)
|
Dyadic
|
Bind ∙ Compositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner Product ∙ Determinant ∙ Power ∙ At ∙ Under ∙ Rank ∙ Depth ∙ Variant ∙ Stencil ∙ Cut ∙ Direct definition (operator) ∙ Identity (Lev, Dex)
|
Quad names
|
Index origin ∙ Comparison tolerance ∙ Migration level ∙ Atomic vector
|