Magnitude

From APL Wiki
Revision as of 02:43, 29 May 2020 by Bubbler (talk | contribs) (Created page with "{{Built-in|Magnitude|<nowiki>|</nowiki>}} or '''Absolute Value''' is a monadic scalar function which gives the absolute value of a real or...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Magnitude (|) or Absolute Value is a monadic scalar function which gives the absolute value of a real or complex number. Magnitude shares the glyph | with the dyadic arithmetic function Residue.

Examples

      |0 1 2 ¯1 ¯2
0 1 2 1 2
 
      |0J2 ¯3J¯4
2 5

Properties

The magnitude of any number is a non-negative real number.

For real numbers, the magnitude equals the original number without sign.

      ⍝ TODO

For complex numbers, the magnitude is defined as the Euclidean distance from the number 0 on the complex plane.

      ⍝ TODO
Works in: Dyalog APL

Any real or complex number is equal to the product of its signum and magnitude.

      ⍝ TODO
Works in: Dyalog APL

External links

Documentation

APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare RootRound
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentityStopSelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndexCartesian ProductSort
Selector Index generatorGradeIndex OfInterval IndexIndicesDealPrefix and suffix vectors
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axisIdentity (Null, Ident)
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)Identity (Lev, Dex)
Quad names Index originComparison toleranceMigration levelAtomic vector