This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / New in Version 3.0 / Lists and Matrices  /
Outer

  • Outer[ f , , , ... ] gives the generalized outer product of the , forming all possible combinations of the lowest-level elements in each of them.
  • Outer[ f , , , ... , n ] treats as separate elements only sublists at level n in the .
  • Outer[ f , , , ... , , , ... ] treats as separate elements only sublists at level in the corresponding .
  • Example: Outer[f, a,b , x,y ].
  • Outer[Times, , ] gives an outer product.
  • The result of applying Outer to the tensors and is the tensor with elements f [ , ]. Applying Outer to two tensors of ranks and gives a tensor of rank .
  • The heads of both must be the same, but need not necessarily be List.
  • The need not necessarily be cuboidal arrays.
  • The specifications of levels must be integers.
  • If only a single level specification is given, it is assumed to apply to all the . If there are several , but fewer than the number of , all levels in the remaining will be used.
  • See the Mathematica book: Section 1.8.13, Section 2.2.10, Section 3.7.5Section 3.7.11.
  • See also: Inner, Distribute, Cross.

    Further Examples

    Outer is potentially useful whenever you want to combine each element from one array with each element of another. This gives all possible pairs from the two lists.

    In[1]:=

    Out[1]=

    You can also combine elements from more than two arrays.

    In[2]:=

    Out[2]=

    The arrays being combined may be more complicated than simply lists. The outer product of a tensor and a tensor is a tensor.

    In[3]:=

    Out[3]=

    In[4]:=

    Out[4]=

    By given Outer additional numerical arguments, you can make it treat multidimensional tensors as if they were shallower. Here we're combining the first-level entries of tensor1 ({a,b}, etc.) with the second-level entries of tensor2 ({1,2}, etc.), rather than combining a with 1, etc.

    In[5]:=

    Out[5]=

    In[6]:=