({{, (RefLink[Composition, paclet:ref/Composition])[(Subscript[f, 1]),(Subscript[f, 2]),(Subscript[f, 3]),…]
represents a composition of the functions (Subscript[f, 1]), (Subscript[f, 2]), (Subscript[f, 3]), …. }})

OpenersNotesSection(Spacer1)Details

(RefLink[Composition, paclet:ref/Composition]) allows you to build up compositions of functions which can later be applied to specific arguments.

(RefLink[Composition, paclet:ref/Composition]) objects containing (RefLink[Identity, paclet:ref/Identity]) or (RefLink[InverseFunction, paclet:ref/InverseFunction])[f] are automatically simplified when possible. »

(RefLink[Composition, paclet:ref/Composition]) has the attributes (RefLink[Flat, paclet:ref/Flat]) and (RefLink[OneIdentity, paclet:ref/OneIdentity]).

(RefLink[Composition, paclet:ref/Composition]) can be entered in the form (Subscript[f, 1]) @* (Subscript[f, 2]) @* ….

OpenersPrimaryExamplesSection(Spacer1)Examples  (18)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Apply a composition of functions to arguments:

Composition[f,g,h][x,y]

Apply a composition using infix notation:

f @* g @* h @ x

OpenersExampleSection1(Spacer1)Scope  (6)

Use pure functions inside (RefLink[Composition, paclet:ref/Composition]):

Composition[1+#^#&,a #&,#/(#+1)&][x]

Use (RefLink[InverseFunction, paclet:ref/InverseFunction]) on (RefLink[Composition, paclet:ref/Composition]):

InverseFunction[Composition[f,g,h]]

InverseFunction[Composition[f,g,h]][x]

Use (RefLink[Apply, paclet:ref/Apply]) with (RefLink[Composition, paclet:ref/Composition]):

Composition[f,g,h]@@{x,y,z}

(RefLink[Identity, paclet:ref/Identity]) inside a composition is simplified:

Composition[f,Identity,g]

(RefLink[InverseFunction, paclet:ref/InverseFunction]) inside a composition is simplified if possible:

Sin @* InverseFunction[Tan]

Create a compound operator that looks for symbols and then multiplies them by 2:

f= 2#& @*Cases[_Symbol]

Apply that function to a list:

f[{a, "b", c, d, "e",5}]

OpenersExampleSection2(Spacer1)Applications  (2)

Create a composition of a sequence of functions:

Apply[Composition,Array[Subscript[f,#]&,10]][x]

Create a sum of numbers to be displayed in held form:

Composition[HoldForm,Plus]@@Range[20]

OpenersExampleSection3(Spacer1)Properties & Relations  (7)

(RefLink[Composition, paclet:ref/Composition]) composes on the left:

Composition[f,g][x]

(RefLink[RightComposition, paclet:ref/RightComposition]) composes on the right:

RightComposition[f,g][x]

Pure functions let you set up objects that work like (RefLink[Composition, paclet:ref/Composition]):

Composition[f,g,h][x]

f[g[h[#]]]&[x]

Different ways of entering compositions:

Composition[f,g,h][x]

f@*g@*h@x

f@g@h@x

x//h//g//f

Compose a function with itself n times using (RefLink[Nest, paclet:ref/Nest]):

Nest[f,x,3]

Composition[f,f,f][x]

Compose a function with itself n times using (RefLink[RSolve, paclet:ref/RSolve]):

f[x_]:=((2x+3)/(x+4))

fn=a/.First@RSolve[{a[n+1]==f[a[n]],a[0]==0},a,n]

fn[10]

(Composition@@Table[f,{10}])[0]

Compose (RefLink[TransformationFunction, paclet:ref/TransformationFunction]) objects:

Composition[RotationTransform[θ],RotationTransform[ϕ]]//Simplify

Composition[RotationTransform[θ],RotationTransform[-θ]]//Simplify

Use (RefLink[ComposeSeries, paclet:ref/ComposeSeries]) to do composition of series expansions:

Series[Composition[Sin,Cos][x],{x,0,3}]

ComposeSeries[Series[Sin[x],{x,Cos[0],3}],Series[Cos[x],{x,0,3}]]

OpenersExampleSection4(Spacer1)Neat Examples  (1)

Tabulate square roots of values without using auxiliary variables:

TableForm[Composition[Through,{Identity,Sqrt}]/@{0,1.0,2.0,3.0,4.0}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[RightComposition, paclet:ref/RightComposition])  ▪  (RefLink[ComposeList, paclet:ref/ComposeList])  ▪  (RefLink[Nest, paclet:ref/Nest])  ▪  (RefLink[Function, paclet:ref/Function])  ▪  (RefLink[ComposeSeries, paclet:ref/ComposeSeries])  ▪  (RefLink[Identity, paclet:ref/Identity])  ▪  (RefLink[Construct, paclet:ref/Construct])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Working with Operators, paclet:tutorial/WorkingWithOperators])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Function Composition & Operator Forms, paclet:guide/FunctionCompositionAndOperatorForms])}, {▪(RefLinkPlain[Functional Programming, paclet:guide/FunctionalProgramming])}, {▪(RefLinkPlain[Structural Operations on Expressions, paclet:guide/StructuralOperationsOnExpressions])}})}})