Divide: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
:''This page describes the dyadic arithmetic function. For reciprocal of a single argument, see [[Reciprocal]].''
:''This page describes the dyadic arithmetic function. For reciprocal of a single argument, see [[Reciprocal]].''


{{Built-in|Divide|÷}} is a [[dyadic]] [[scalar function]] which gives the arithmetic ratio of its [[argument]]s. Divide shares the [[glyph]] <source lang=apl inline>÷</source> with the monadic arithmetic function [[Reciprocal]], and its result is the left argument divided by the right argument.
{{Built-in|Divide|÷}} is a [[dyadic]] [[scalar function]] which gives the arithmetic ratio of its [[argument]]s. Divide shares the [[glyph]] <syntaxhighlight lang=apl inline>÷</syntaxhighlight> with the monadic arithmetic function [[Reciprocal]], and its result is the left argument divided by the right argument.


== Examples ==
== Examples ==
<source lang=apl>
<syntaxhighlight lang=apl>
       2 0 5÷4 0 2
       2 0 5÷4 0 2
0.5 1 2.5
0.5 1 2.5
Line 14: Line 14:
       2 0 5÷4 0 0
       2 0 5÷4 0 0
0.5 0 0
0.5 0 0
</source>
</syntaxhighlight>


== Properties ==
== Properties ==
Line 25: Line 25:


== See also ==
== See also ==
* [[Residue]]
* [[Subtract]]
* [[Subtract]]
* [[Root]]
* [[Root]]
Line 32: Line 33:
=== Documentation ===
=== Documentation ===


* [http://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Divide.htm Dyalog]
* [https://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Divide.htm Dyalog]
* J [https://www.jsoftware.com/help/dictionary/d130.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/percent#dyadic NuVoc] (as <syntaxhighlight lang=j inline>%</syntaxhighlight>)
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar dyadic functions]]
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar dyadic functions]]

Latest revision as of 21:48, 10 September 2022

This page describes the dyadic arithmetic function. For reciprocal of a single argument, see Reciprocal.
÷

Divide (÷) is a dyadic scalar function which gives the arithmetic ratio of its arguments. Divide shares the glyph ÷ with the monadic arithmetic function Reciprocal, and its result is the left argument divided by the right argument.

Examples

      2 0 5÷4 0 2
0.5 1 2.5
 
      3j1 2.5 4j5÷2 1j1 .2
1.5J0.5 1.25J¯1.25 20J25
 
      ⎕DIV←1  ⍝ this sets division by 0 to always return 0
      2 0 5÷4 0 0
0.5 0 0

Properties

Division is anti-commutative: swapping the arguments yield the reciprocal of the result.

Reduction and scan

Reduction with Division gives the alternating product.

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