Conjugate

From APL Wiki
Revision as of 11:32, 14 May 2020 by Marshall (talk | contribs) (→‎Mathematics: WP link style)
Jump to navigation Jump to search

Conjugate (+) is a monadic scalar function which negates the imaginary component of a complex argument. Because many APLs do not have a dedicated Identity function, but also do not support complex numbers, Conjugate is often used to return the argument unchanged. This usage is discouraged in modern APLs in favor of the Identity function (usually ). Conjugate shares the glyph + with Add.

Examples

Conjugate leaves real numbers unchanged but negates the imaginary part of complex numbers.

      + 0 2 ¯1.1 1E300 ¯200
0 2 ¯1.1 1E300 ¯200
      + 2J3 ¯4J¯3 ¯12 1.5J1.5
2J¯3 ¯4J3 ¯12 1.5J¯1.5

As identity function

In early APLs Conjugate was frequently used to return the argument unchanged, for example to display a shy result or break up stranding:

      +a←2 3
2 3
      *∘2⍣3 +a
256 6561

Sometimes the name "Identity" was even used for +. Although this usage is becoming rare among new APLers, it may still affect the behavior of Conjugate. For instance, in Dyalog APL, Conjugate will allow a non-numeric argument and return it unchanged even though other monadic scalar functions give a DOMAIN ERROR:

      + ⎕NULL
[Null]
      - ⎕NULL
DOMAIN ERROR
      -⎕NULL
      ∧

Properties

Like Negate, Conjugate is its own Inverse.

The conjugate of a number is proportional to (that is, a real multiple of) its Reciprocal. Specifically, since for any complex number z, z×+z   (+z)×z is a real number (the square of the Magnitude of z), we have z×((+z)÷z×+z)   1, so by definition (+z)÷z×+z is ÷z. If z is a unit complex number (for instance the result of Signum), then +z   ÷z.

Hypercomplex numbers

The conjugate of a hypercomplex number (a quaternion or octonion) negates all imaginary components, that is, every component but the real part. Somewhat surprisingly, this maintains the property that z×+z   (+z)×z is a real number. Therefore the conjugate can be used to define the reciprocal of a complex number using only real division (dividing a hypercomplex number by a real number divides each component by that numer).

Numerical precision

Like Negate, Conjugate almost never suffers issues with numerical precision. This is because negating a component of a complex number is exact in all common number systems.

External links

Mathematics

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