Imaginary: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Text replacement - "</source>" to "</syntaxhighlight>")
Line 1: Line 1:
{{Built-in|Imaginary|⌾}} is a [[monadic]] [[scalar function]] which multiplies the [[argument]] by the [[wikipedia:imaginary unit|imaginary unit]] <source lang=apl inline>0J1</source>, usually denoted <math>i</math> or <math>j</math> in traditional mathematics. This can be seen as a mapping from a real number to a pure imaginary number (a [[complex number]] with the real part of 0). It was added to [[J]] as <source lang=j inline>j.</source> together with initial support for complex numbers, and was adopted in [[Extended Dyalog APL]] using the [[glyph]] <source lang=apl inline>⌾</source> as a monadic counterpart of [[Complex (function)|Complex]]. In other APL implementations that support complex numbers, [[Circular]] with the left argument of <source lang=apl inline>¯11</source> has the same functionality as Imaginary.
{{Built-in|Imaginary|⌾}} is a [[monadic]] [[scalar function]] which multiplies the [[argument]] by the [[wikipedia:imaginary unit|imaginary unit]] <source lang=apl inline>0J1</syntaxhighlight>, usually denoted <math>i</math> or <math>j</math> in traditional mathematics. This can be seen as a mapping from a real number to a pure imaginary number (a [[complex number]] with the real part of 0). It was added to [[J]] as <source lang=j inline>j.</syntaxhighlight> together with initial support for complex numbers, and was adopted in [[Extended Dyalog APL]] using the [[glyph]] <source lang=apl inline>⌾</syntaxhighlight> as a monadic counterpart of [[Complex (function)|Complex]]. In other APL implementations that support complex numbers, [[Circular]] with the left argument of <source lang=apl inline>¯11</syntaxhighlight> has the same functionality as Imaginary.


== Examples ==
== Examples ==
Line 6: Line 6:
       ⌾ 3 ¯4 6
       ⌾ 3 ¯4 6
0J3 0J¯4 0J6
0J3 0J¯4 0J6
</source>{{Works in|[[Extended Dyalog APL]]}}
</syntaxhighlight>{{Works in|[[Extended Dyalog APL]]}}


Imaginary is equivalent to [[Complex (function)|Complex]] with the default left argument of 0.
Imaginary is equivalent to [[Complex (function)|Complex]] with the default left argument of 0.
Line 13: Line 13:
       0 ⌾ 3 ¯4 6
       0 ⌾ 3 ¯4 6
0J3 0J¯4 0J6
0J3 0J¯4 0J6
</source>{{Works in|[[Extended Dyalog APL]]}}
</syntaxhighlight>{{Works in|[[Extended Dyalog APL]]}}


== See also ==
== See also ==

Revision as of 22:04, 10 September 2022

Imaginary () is a monadic scalar function which multiplies the argument by the imaginary unit <source lang=apl inline>0J1</syntaxhighlight>, usually denoted or in traditional mathematics. This can be seen as a mapping from a real number to a pure imaginary number (a complex number with the real part of 0). It was added to J as <source lang=j inline>j.</syntaxhighlight> together with initial support for complex numbers, and was adopted in Extended Dyalog APL using the glyph <source lang=apl inline>⌾</syntaxhighlight> as a monadic counterpart of Complex. In other APL implementations that support complex numbers, Circular with the left argument of <source lang=apl inline>¯11</syntaxhighlight> has the same functionality as Imaginary.

Examples

Try it online!<source lang=apl>

     ⌾ 3 ¯4 6

0J3 0J¯4 0J6

</syntaxhighlight>

Imaginary is equivalent to Complex with the default left argument of 0.

Try it online!<source lang=apl>

     0 ⌾ 3 ¯4 6

0J3 0J¯4 0J6

</syntaxhighlight>

See also

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