Add: Difference between revisions

Jump to navigation Jump to search
75 bytes removed ,  14:49, 20 November 2019
m
9 revisions imported: Migrate from miraheze
Miraheze>Adám Brudzewsky
m (Text replacement - "http://help.dyalog.com/latest/Content/Language/" to "http://help.dyalog.com/latest/index.htm#Language/")
m (9 revisions imported: Migrate from miraheze)
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Built-in|Add|+}}, '''Plus''', '''Addition''', or '''Sum''', is a [[dyadic]] [[scalar function]] that [https://en.wikipedia.org/wiki/Addition adds] numbers together. As a [[basic arithmetic]] operation, Add is subject to the language's [[number]] specification. Add shares the glyph <source lang=apl inline>+</source> with the [[monadic]] function [[Conjugate]], and is closely related to [[Subtract]] (<source lang=apl inline>-</source>).
{{Built-in|Add|+}}, '''Plus''', '''Addition''', or '''Sum''', is a [[dyadic]] [[scalar function]] that [[wikipedia:Addition|adds]] numbers together. As a [[basic arithmetic]] operation, Add is subject to the language's [[number]] specification. Add shares the glyph <source lang=apl inline>+</source> with the [[monadic]] function [[Conjugate]], and is closely related to [[Subtract]] (<source lang=apl inline>-</source>).


== Examples ==
== Examples ==
Line 12: Line 12:
== Properties ==
== Properties ==


Addition is [https://en.wikipedia.org/wiki/Commutative_property commutative] in almost all number systems. It is [https://en.wikipedia.org/wiki/Associative_property associative] when performed with no rounding, but is unlikely to be associative when rounded to an inexact precision (see [[#Floating point error|Floating point error]]).
Addition is [[wikipedia:Commutative property|commutative]] in almost all number systems. It is [[wikipedia:Associative property|associative]] when performed with no rounding, but is unlikely to be associative when rounded to an inexact precision (see [[#Floating point error|Floating point error]]).


The [[identity element]] for Add is <source lang=apl inline>0</source>. The [[inverse]] of the function <source lang=apl inline>n∘+</source> or the equivalent function <source lang=apl inline>+∘n</source> is <source lang=apl inline>-∘n</source>. Using [[Commute]] (<source lang=apl inline>⍨</source>), we can write <source lang=apl inline>+⍣¯1</source> {{←→}} <source lang=apl inline>-⍨</source>.
The [[identity element]] for Add is <source lang=apl inline>0</source>. The [[inverse]] of the function <source lang=apl inline>n∘+</source> or the equivalent function <source lang=apl inline>+∘n</source> is <source lang=apl inline>-∘n</source>. Using [[Commute]] (<source lang=apl inline>⍨</source>), we can write <source lang=apl inline>+⍣¯1</source> {{←→}} <source lang=apl inline>-⍨</source>.
Line 20: Line 20:
== Scalar mapping ==
== Scalar mapping ==


In mathematics, addition of two identical structures almost always follows the same rules as in APL: it maps over the structures element-wise. This is a fundamental property of a (finite-dimensional) [https://en.wikipedia.org/wiki/Vector_space vector space], in which addition of two vectors is equivalent to adding the coefficients of basis vectors one by one. This property likely inspired APL's definition of a scalar function.
In mathematics, addition of two identical structures almost always follows the same rules as in APL: it maps over the structures element-wise. This is a fundamental property of a (finite-dimensional) [[wikipedia:vector space|vector space]], in which addition of two vectors is equivalent to adding the coefficients of basis vectors one by one. This property likely inspired APL's definition of a scalar function.


Addition of [[Complex number|complex]] and [[hypercomplex numbers]] can also be considered an element-wise operation, since each of these types of numbers forms a vector space over the reals. Addition of scalars is always performed within a single domain: mixed-type addition such as adding a real to a complex number treats the real number as complex with imaginary part zero.
Addition of [[Complex number|complex]] and [[hypercomplex numbers]] can also be considered an element-wise operation, since each of these types of numbers forms a vector space over the reals. Addition of scalars is always performed within a single domain: mixed-type addition such as adding a real to a complex number treats the real number as complex with imaginary part zero.
Line 45: Line 45:


* [http://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Add.htm Dyalog]
* [http://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Add.htm Dyalog]
* [http://microapl.com/apl_help/ch_020_020_020.htm APLX]
* [http://microapl.com/apl_help/ch_020_020_020.htm APLX]
* [https://www.jsoftware.com/help/dictionary/d100.htm J Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/plus#dyadic J NuVoc]
* [https://www.jsoftware.com/help/dictionary/d100.htm J Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/plus#dyadic J NuVoc]
{{APL built-ins}}
{{APL built-ins}}

Navigation menu