Times: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Adám Brudzewsky moved page Product to Times over redirect: Use common name)
m (Text replacement - "<source" to "<syntaxhighlight")
Tags: Mobile edit Mobile web edit
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
:''This page describes the dyadic arithmetic function. For sign of a single argument, see [[Signum]].''
:''This page describes the dyadic arithmetic function. For sign of a single argument, see [[Signum]].''


{{Built-in|Product|×}}, '''Times''', or '''Multiply''' is a [[dyadic]] [[scalar function]] which gives the arithmetic product of its [[argument]]s. Product shares the [[glyph]] <source lang=apl inline>×</source> with the monadic arithmetic function [[Signum]], and its result is the left argument times the right argument.
{{Built-in|Times|×}}, '''Multiply''', or '''Product''' is a [[dyadic]] [[scalar function]] which gives the arithmetic product of its [[argument]]s. Times shares the [[glyph]] <syntaxhighlight lang=apl inline>×</syntaxhighlight> with the monadic arithmetic function [[Signum]].


== Examples ==
== Examples ==
A long, slow way to write <code>!10</code>:
A long, slow way to write <syntaxhighlight lang=apl inline>!10</syntaxhighlight>, assuming <syntaxhighlight lang=apl inline>⎕IO←1</syntaxhighlight>:
<source lang=apl>
<syntaxhighlight lang=apl>
×/⍳10
×/⍳10
</source>
</syntaxhighlight>


== Properties ==
== Properties ==


Product is commutative: swapping the arguments don't affect the result, e.g. using [[Commute]], <source lang=apl inline>*⍨</source>.
Multiplication is [[wikipedia:Commutative property|commutative]] and [[wikipedia:Associative property|associative]], but, due to floating point error, may result in small differences between mathematically equivalent expressions.


=== Reduction and scan ===
The [[identity element]] for Times is <syntaxhighlight lang=apl inline>1</syntaxhighlight>.


[[Reduction]] with Product gives the product of the whole list.
=== Reduction ===
 
[[Reduction]] with Multiply gives the product of the whole list.
 
== See also ==
* [[Divide]]
* [[Add]]
* [[Power]]


== External links ==
== External links ==
Line 21: Line 28:
=== Documentation ===
=== Documentation ===


* [http://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Multiply.htm Dyalog]
* [https://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Multiply.htm Dyalog]
{{APL built-ins}}
* [http://microapl.com/apl_help/ch_020_020_060.htm APLX]
* J [https://www.jsoftware.com/help/dictionary/d110.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/star#dyadic NuVoc] (as <syntaxhighlight lang=j inline>*</syntaxhighlight>)
* [https://mlochbaum.github.io/BQN/doc/arithmetic.html#basic-arithmetic BQN]
{{APL built-ins}}[[Category:Primitive functions]][[Category:Scalar dyadic functions]]

Latest revision as of 10:48, 11 September 2022

This page describes the dyadic arithmetic function. For sign of a single argument, see Signum.
×

Times (×), Multiply, or Product is a dyadic scalar function which gives the arithmetic product of its arguments. Times shares the glyph × with the monadic arithmetic function Signum.

Examples

A long, slow way to write !10, assuming ⎕IO←1:

×/⍳10

Properties

Multiplication is commutative and associative, but, due to floating point error, may result in small differences between mathematically equivalent expressions.

The identity element for Times is 1.

Reduction

Reduction with Multiply gives the product of the whole list.

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