Difference between revisions of "Imaginary"

From APL Wiki
Jump to navigation Jump to search
(Created page with "{{Built-in|Imaginary|⌾}} is a monadic scalar function which multiplies the argument by the imaginary unit <source lang=apl inline>0J1</source>. This can be seen...")
 
Line 1: Line 1:
{{Built-in|Imaginary|⌾}} is a [[monadic]] [[scalar function]] which multiplies the [[argument]] by the imaginary unit <source lang=apl inline>0J1</source>. 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]]. 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 imaginary unit <source lang=apl inline>0J1</source>. 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.
  
 
== Examples ==
 
== Examples ==
Line 5: Line 5:
 
[https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn//1Hf1EdtEx717FMwVji03kTB7P9/AA Try it online!]<source lang=apl>
 
[https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn//1Hf1EdtEx717FMwVji03kTB7P9/AA Try it online!]<source lang=apl>
 
       ⌾ 3 ¯4 6
 
       ⌾ 3 ¯4 6
 +
0J3 0J¯4 0J6
 +
</source>{{Works in|[[Extended Dyalog APL]]}}
 +
 +
Imaginary is equivalent to [[Complex (function)|Complex]] with the default left argument of 0.
 +
 +
[https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn//1Hf1EdtEwwUHvXsUzBWOLTeRMHs/38A Try it online!]<source lang=apl>
 +
      0 ⌾ 3 ¯4 6
 
0J3 0J¯4 0J6
 
0J3 0J¯4 0J6
 
</source>{{Works in|[[Extended Dyalog APL]]}}
 
</source>{{Works in|[[Extended Dyalog APL]]}}

Revision as of 01:20, 4 June 2020

Imaginary () is a monadic scalar function which multiplies the argument by the imaginary unit 0J1. 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 j. together with initial support for complex numbers, and was adopted in Extended Dyalog APL using the glyph as a monadic counterpart of Complex. In other APL implementations that support complex numbers, Circular with the left argument of ¯11 has the same functionality as Imaginary.

Examples

Try it online!

       3 ¯4 6
0J3 0J¯4 0J6

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

Try it online!

      0  3 ¯4 6
0J3 0J¯4 0J6

Documentation

References


APL built-ins [edit]
Primitive functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentitySelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndex
Selector Index generatorGradeIndex OfInterval IndexIndicesDeal
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Primitive operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-beamSpawnFunction axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Atop, Over) ∙ Inner ProductPowerAtUnderRankDepthVariantStencilCut (J)
Quad names
Arrays Index originMigration levelAtomic vector
Functions Name classCase convertUnicode convert
Operators SearchReplace