This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Programming / Functional Programming  /
Inner

  • Inner[ f , , , g ] is a generalization of Dot in which f plays the role of multiplication and g of addition.
  • Example: Inner[f, a,b , x,y ,g].
  • Inner[f, a,b , c,d , x,y ,g].
  • Like Dot, Inner effectively contracts the last index of the first tensor with the first index of the second tensor. Applying Inner to a rank tensor and a rank tensor gives a rank tensor.
  • Inner[ f , , ] uses Plus for g.
  • Inner[ f , , , g , n ] contracts index n of the first tensor with the first index of the second tensor.
  • The heads of and must be the same, but need not necessarily be List.
  • See the Mathematica book: Section 2.2.10Section 3.7.11.
  • See also: Outer, Thread, MapThread.

    Further Examples

    Here is another way (beside Dot) to get the dot product of two vectors.

    In[1]:=

    Out[1]=

    This is a generalized inner product.

    In[2]:=

    Out[2]=

    This gives the inner product of two tensors and shows their ranks.

    In[3]:=

    In[4]:=

    In[5]:=

    Out[5]=

    In[6]:=

    Out[6]=