Plus

x+y+z
represents a sum of terms.

DetailsDetails

  • Plus has attributes Flat, Orderless, and OneIdentity.
  • The default value for arguments of Plus, as used in x_. patterns, is 0. »
  • Plus[] is taken to be 0.
  • Plus[x] is x.
  • x+0 evaluates to x, but x+0.0 is left unchanged.
  • In mixed fractions such as 1, the implicit addition can be entered as 1 Esc+Esc or 1 \[ImplicitPlus]. This evaluates to 1+, but implicit addition is an operator with much higher precedence than +.
  • Unlike other functions, Plus applies builtin rules before userdefined ones. As a result, it is not possible to make definitions such as 2+2=5.

Background & Context
Background & Context

  • Plus is a function that does addition (summation) of expressions. The expression Plus[a,b,c,] is commonly represented using the shorthand syntax a+b+c+. Special cases include Plus[], which is taken to be 0, and Plus[x], which is taken to be x.
  • Plus sorts its arguments and collapses any terms of the same type. Plus also threads element-wise over lists.
  • To perform summation at a particular level of a list or to apply compensative summation to reduce numerical error for inexact summands, the function Total can be used. Accumulate gives a list of the successive accumulated totals of elements in a list. AddTo, Increment, and PreIncrement can be used to increase the value of a given variable. Minus gives the arithmetic negation of an expression, and Subtract gives the difference of two numbers.
  • Summation of a function over a range or list of arguments is done using the function Sum.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

In[1]:=
Click for copyable input
Out[1]=

Plus threads element-wise over lists:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Explicit FullForm:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 1988
(1.0)
| Updated in 2007
(6.0)