Square Root: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
(Forgot about NARS2000)
m (Text replacement - "<source" to "<syntaxhighlight")
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Built-in|Square Root|√}} (<source lang=j inline>%:</source> in [[J]]) is a [[monadic]] [[scalar function]] that returns the [[wikipedia:square root|square root]] of its [[argument]], that is, a number whose square is the argument. As there are two such numbers for any non-zero argument (negating one possible result gives another), the result returned is taken to have either a positive real part, or, if the real part is zero, a non-negative imaginary part; in particular, if the result is real then it will be zero or greater. Square Root may also be defined in terms of the [[Power]] function, by raising the argument to the power one-half. It is considered a case of the [[dyadic]] function [[Root]] (which uses the same [[glyph]]), with a default left argument of 2. Square Root is defined in [[J]], [[NARS2000]], [[dzaima/APL]], and [[Extended Dyalog APL]].
{{Built-in|Square Root|√}} (<syntaxhighlight lang=j inline>%:</syntaxhighlight> in [[J]]) is a [[monadic]] [[scalar function]] that returns the [[wikipedia:square root|square root]] of its [[argument]], that is, a number whose square is the argument. As there are two such numbers for any non-zero argument (negating one possible result gives another), the result returned is taken to have either a positive real part, or, if the real part is zero, a non-negative imaginary part; in particular, if the result is real then it will be zero or greater. Square Root may also be defined in terms of the [[Power]] function, by raising the argument to the power one-half. It is considered a case of the [[dyadic]] function [[Root]] (which uses the same [[glyph]]), with a default left argument of 2. Square Root is defined in [[J]], [[NARS2000]], [[dzaima/APL]], and [[Extended Dyalog APL]].


== History ==
== History ==
The radical symbol for the square root has been used in mathematics for centuries, and was suggested early in APL's development by [[Eugene McDonnell]], who stated that "when I designed the APL printer trains for the IBM 1403 printer, I included the radical symbol √ on the train, in the expectation that one day this function would be added to APL."<ref>[[Eugene McDonnell]]. [https://doi.org/10.1145/22415.22050 "A perfect square root routine"] ([https://www.jsoftware.com/papers/eem/sqrt.htm web]) at [[APL86]].</ref> It was featured in [[J]] following McDonnell's design but written with the ASCII bigraph <source lang=j inline>%:</source>, and was introduced with the radical symbol by [[NARS2000]]. More recently, it was added first to [[Extended Dyalog APL]] and then to [[dzaima/APL]] in 2018.
The radical symbol for the square root has been used in mathematics for centuries, and was suggested early in APL's development by [[Eugene McDonnell]], who stated that "when I designed the APL printer trains for the IBM 1403 printer, I included the radical symbol √ on the train, in the expectation that one day this function would be added to APL."<ref>[[Eugene McDonnell]]. [https://doi.org/10.1145/22415.22050 "A perfect square root routine"] ([https://www.jsoftware.com/papers/eem/sqrt.htm web]) at [[APL86]].</ref> It was featured in [[J]] following McDonnell's design but written with the ASCII bigraph <syntaxhighlight lang=j inline>%:</syntaxhighlight>, and was introduced with the radical symbol by [[NARS2000]]. More recently, it was added first to [[Extended Dyalog APL]] and then to [[dzaima/APL]] in 2018.


== See also ==
* [[Reciprocal]]
== External links ==
== External links ==
=== Documentation ===
=== Documentation ===
* [http://wiki.nars2000.org/index.php/Root NARS2000]
* [http://wiki.nars2000.org/index.php/Root NARS2000]
* J [https://www.jsoftware.com/help/dictionary/d132.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/percentco NuVoc]
* J [https://www.jsoftware.com/help/dictionary/d132.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/percentco NuVoc]
* [https://mlochbaum.github.io/BQN/doc/arithmetic.html#basic-arithmetic BQN]


== References ==
== References ==
<references/>
<references/>


{{APL built-ins}}[[Category:Scalar monadic functions]]
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar monadic functions]]

Latest revision as of 11:05, 11 September 2022

Square Root () (%: in J) is a monadic scalar function that returns the square root of its argument, that is, a number whose square is the argument. As there are two such numbers for any non-zero argument (negating one possible result gives another), the result returned is taken to have either a positive real part, or, if the real part is zero, a non-negative imaginary part; in particular, if the result is real then it will be zero or greater. Square Root may also be defined in terms of the Power function, by raising the argument to the power one-half. It is considered a case of the dyadic function Root (which uses the same glyph), with a default left argument of 2. Square Root is defined in J, NARS2000, dzaima/APL, and Extended Dyalog APL.

History

The radical symbol for the square root has been used in mathematics for centuries, and was suggested early in APL's development by Eugene McDonnell, who stated that "when I designed the APL printer trains for the IBM 1403 printer, I included the radical symbol √ on the train, in the expectation that one day this function would be added to APL."[1] It was featured in J following McDonnell's design but written with the ASCII bigraph %:, and was introduced with the radical symbol by NARS2000. More recently, it was added first to Extended Dyalog APL and then to dzaima/APL in 2018.

See also

External links

Documentation

References


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