Function Repository Resource:

BakerCampbellHausdorffTerms

Source Notebook

Generate terms in the Baker–Campbell–Hausdorff expansion

Contributed by: Mohammad Bahrami

ResourceFunction["BakerCampbellHausdorffTerms"][{op1,op2,,opm},n,alg]

generates the degree-n term of the Baker-Campbell-Hausdorff expansion.

Details and Options

The Baker-Campbell-Hausdorff (BCH) expansion is defined as with alg as the underlying operation between the non-commutative operators opi. The degree-n term in the BCH expansion is the part that involves n Lie algebra elements combined through n-1 nested commutators and coefficients.
The BCH formula solves eXeY=eZ for noncommutative operators X and Y in a Lie algebra.
The BCH expansion is the sum of terms over n.
The default operation between operators is Dot.
ResourceFunction["BakerCampbellHausdorffTerms"] accepts the option "CommutatorForm", which is set as False by default. Setting it to True gives the output in terms of Commutor.
ResourceFunction["BakerCampbellHausdorffTerms"] requires version 14.3 or higher of the Wolfram Language.

Examples

Basic Examples (5) 

Degree-1 of Baker-Campbell-Hausdorff formula for two operators:

In[1]:=
ResourceFunction["BakerCampbellHausdorffTerms"][{x, y}, 1]
Out[1]=

Degree-2 of Baker-Campbell-Hausdorff formula for two operators, in the commutator form:

In[2]:=
ResourceFunction["BakerCampbellHausdorffTerms"][{x, y}, 2, "CommutatorForm" -> True]
Out[2]=

Degree-4 of Baker-Campbell-Hausdorff formula for two operators:

In[3]:=
ResourceFunction["BakerCampbellHausdorffTerms"][{x, y}, 4] // NonCommutativeExpand[#, Dot] &
Out[3]=

Degree-2 of Baker-Campbell-Hausdorff formula for three symbolic matrices:

In[4]:=
op = Table[MatrixSymbol["x" <> ToString[j], \[FormalN]], {j, 3}]
Out[4]=
In[5]:=
ResourceFunction["BakerCampbellHausdorffTerms"][op, 2] // NonCommutativeExpand[#, Dot] &
Out[5]=

Degree-3 of Baker-Campbell-Hausdorff formula for three operators with Composition as the action:

In[6]:=
ResourceFunction["BakerCampbellHausdorffTerms"][{x, y, w}, 3, Composition] // NonCommutativeExpand[#, Composition] &
Out[6]=

Scope (2) 

Degree-3 of Baker-Campbell-Hausdorff formula with NonCommutativeMultiply as the action between operators:

In[7]:=
ResourceFunction["BakerCampbellHausdorffTerms"][{x, y}, 3, NonCommutativeMultiply] // NonCommutativeExpand[#, NonCommutativeMultiply] &
Out[7]=

Show degree-3 of Baker-Campbell-Hausdorff formula, for four operators:

In[8]:=
ResourceFunction["BakerCampbellHausdorffTerms"][{x, y, z, w}, 3] // NonCommutativeExpand[#, Dot] &
Out[8]=

Options (2) 

Show degree-3 of Baker-Campbell-Hausdorff formula for two operators by holding the commutator form:

In[9]:=
ResourceFunction["BakerCampbellHausdorffTerms"][{x, y}, 3, "CommutatorForm" -> True]
Out[9]=

Show degree-2 of Baker-Campbell-Hausdorff formula for four symbolic matrices by holding the commutator form:

In[10]:=
ResourceFunction["BakerCampbellHausdorffTerms"][
 Table[MatrixSymbol["x" <> ToString[j], \[FormalN]], {j, 4}], 2, "CommutatorForm" -> True]
Out[10]=

Applications (2) 

Show a few terms of Baker-Campbell-Hausdorff formula 𝒵=Log(ⅇX1X2…ⅇXn) with three non-commutative operators Xj:

In[11]:=
With[{ops = Table[ToString[Subscript[x, j], StandardForm], {j, 3}]},
 Grid[Table[{ToString[Subscript[\[ScriptCapitalZ], j], StandardForm], ResourceFunction["BakerCampbellHausdorffTerms"][ops, j] // NonCommutativeExpand[#, Dot] &}, {j, 5}], Frame -> All, Alignment -> Left]]
Out[11]=

Show the commutator form of 𝒵=Log(ⅇX1X2):

In[12]:=
Grid[Table[{ToString[Subscript[\[ScriptCapitalZ], j], StandardForm], ResourceFunction["BakerCampbellHausdorffTerms"][{x, y}, j, "CommutatorForm" -> True] // NonCommutativeExpand[#, Dot] &}, {j, 4}], Frame -> All, Alignment -> Left]
Out[12]=

Publisher

Mads Bahrami

Version History

  • 1.0.0 – 23 July 2025

Source Metadata

Related Resources

License Information