Giovanni Peccati and Murad S. Taqqu

advertisement
Mathematica Companion Notebook to :
Giovanni Peccati
and
Murad S. Taqqu
"Wiener Chaos: Moments,
Cumulants and Diagrams"
"A survey with computer implementation"
Bocconi & Springer Series, Vol. 1
Springer Verlag (2010)
ISBN: 978-88-470-1678-1
(November 10, 2010)
Table of Contents
Table of Contents
ç General Introduction
ç When Starting
ç Error Messages
à Integer Partitions
à Basic Set Partitions
à Operations with Set Partitions
à Partition Segments
à Mobius Formula
à Moments and Cumulants
à Gaussian Multiple Integrals
à Poisson Multiple Integrals
à Contraction and Symmetrization
à Solving Partition Equations involving P*
à Product of Two Gaussian Multiple Integrals
à Product of Two Poisson Multiple Integrals
à MSets and MZeroSets
à Hermite Polynomials
à Poisson-Charlier Polynomials
General Introduction
The Mathematica program (version 7.0) must be installed on your computer or remotely through your system.
The filename of a Mathematica notebooks ends with a ".nb". In Windows, double-clicking on the notebook will open the notebook and start Mathematica.
To execute the entire notebook (on Windows), press Control-A (to select all the cells in the notebook), followed by Shift-Enter.
These actions will execute all of the function definitions and examples in this notebook. This may take a little time. You can then,
in this notebook or a new notebook that you have opened, apply the functions created in this notebook to new set partitions or to
create additional examples of your own. You may type, paste, or outline a command and then press Shift-Enter to execute it.
Please note that the execution of any of these functions requires the use of the Combinatorica package in Mathematica (which
can be activated by executing the line Needs["Combinatorica`"]. We automatically execute this package in this notebook.
If possible, include also the notebook "StyleFile978-88-470-1678-1.nb" in the same directory as this notebook, so that this
notebook will be nicely formatted.
Please note that the execution of any of these functions requires the use of the Combinatorica package in Mathematica (which
can be activated by executing the line Needs["Combinatorica`"]. We automatically execute this package in this notebook.
If possible, include also the notebook "StyleFile978-88-470-1678-1.nb" in the same directory as this notebook, so that this
notebook will be nicely formatted.
To type a command, simply type the appropriate function and the desired argument and press Shift-Enter to execute the cell in
which the command is located. Mathematica will label the command as a numbered input and the output will be numbered
correspondingly. One can recall previous outputs with commands like "%5", which would recover the fifth output in the current
Mathematica session. Unexecuted cells have no input label.
A warning: Some of the functions in this notebook use a brute-force methodology. The number of set partitions associated to a
positive integer n grows very rapidly, and so any brute-force methodology may suffer from combinatorial explosion. Unless you
have lots of time and computational resources at your disposal, it may be better to investigate examples for which n is small.
Comments about the time it takes to evaluate a function. To evaluate the time it takes to simulate 1,000,000 realizations of a
standard normal random variable, type
In[1]:=
Out[1]=
RandomReal@NormalDistribution @0, 1D, 81 000 000<D;  AbsoluteTiming
80.2656250, Null<
The semicolon supresses the display of the output (except for the timing result), which is generated by AbsoluteTiming. The
first part of the output is the number of seconds it took Mathematica to generate 1,000,000 realizations of a standard normal
random variable. The output was surpressed, which is why the symbol Null appears in the second position.
Comments about the function names. We typically give the functions long, informative names. In practical use, one may
sometimes want to use a shorter name. For example, to have the function Chi do the same thing as the function
CumulantVectorToMoments, set
In[2]:=
Chi = CumulantVectorToMoments ;
Comments about Mathematica notation. In Mathematica, a set partition is denoted in a particular way, for example,
881, 2, 4<, 83<, 85<< is a set partition of the set 81, 2, 3, 4, 5<. The trivial, or maximal, partition consisting of the entire set is
denoted 881, 2, 3, 4, 5<< and the set partition consisting entirely of singletons is denoted 881<, 82<, 83<, 84<, 85<<.
Comments about hard returns. Mathematica ignores hard returns. Therefore, if the input line is long, one can press "Enter" in
order to subdivide it.
Comments about stopping the execution of a function. Hold down the "Alt" key and then press the "." key, or go to the menu
at the top, choose "Evaluation" and then choose "Abort Evaluation."
Comments about clearing the kernel. Sometimes it is useful to clear all of the local variable and function definitions from the
Mathematica kernel. To do so, go to menu at the top, choose "Evaluation" and then choose "Quit kernel." Quit either the local
kernel on your computer or, if you run Mathematica remotely, the remote kernel. Then re-execute the notebook.
In[3]:=
When Starting
ì Master Functions
Type first the following two commands:
In[4]:=
Needs@"Combinatorica` "D
Off@First::firstD
The first command loads the package Combinatorica. The second command shuts off an error message that does not impact any
of the function outputs. These commands will be executed in sequence.
Integer Partitions
ì IntegerPartitions: find all nonnegative integers that sum up to
an integer n, ignoring order; this is a built-in Mathematica
function
é Example: find all integer partitions of the number 5
In[47]:=
Out[47]=
IntegerPartitions @5D
885<, 84, 1<, 83, 2<, 83, 1, 1<, 82, 2, 1<, 82, 1, 1, 1<, 81, 1, 1, 1, 1<<
For example, the output 83, 1, 1< should be read as the decomposition 5 = 3 + 1 + 1.
é Example: count the number of integer partitions of the number 5
In[48]:=
Out[48]=
Length@IntegerPartitions @5DD
7
ì IntegerPartitionsExponentRepresentation: this function
represents the output of IntegerPartitions in exponent
notation; namely, I1r1 2r2 ... nrn M, where ri is the number of times
that integer i appears in the decomposition, i = 1, ..., n
In[49]:=
IntegerPartitionsExponentRepresentation @n_D :=
Block@8integerpartitions = IntegerPartitions @nD, FillInZeros<,
FillInZeros@t_, list_D := Block@8available = First ž list, unavailable,
additions, complete<, unavailable = Complement@Range@tD, availableD;
additions = 8ð, 0< & ž unavailable; complete = Union@list, additionsD;
Row@Join@8"H"<, Superscript@ð@@1DD, ð@@2DDD & ž complete, 8"L"<DDD;
FillInZeros@n, Tally ž ðD & ž integerpartitions D
é Example: find all integer partitions of the number 5, and express them in exponent notation
In[50]:=
Out[50]=
IntegerPartitionsExponentRepresentation @5D
9H10 20 30 40 51 L, H11 20 30 41 50 L, H10 21 31 40 50 L, H12 20 31 40 50 L, H11 22 30 40 50 L, H13 21 30 40 50 L, H15 20 30 40 50 L=
For example, 5 = 3 + 1 + 1 is expressed as I12 20 31 40 50 M since there are 2 ones and 1 three.
Basic Set Partitions
ì SingletonPartition: generates the singleton set partition of
`
order n, namely 0 = 881<, 82<, ... 8n<<
In[51]:=
SingletonPartition @n_D := Transpose ž 8Range@nD<
é Example: generate the singleton set partition of order 12
In[52]:=
Out[52]=
SingletonPartition @12D
881<, 82<, 83<, 84<, 85<, 86<, 87<, 88<, 89<, 810<, 811<, 812<<
ì MaximalPartition: generates the maximal set partition of order
`
n, namely 1 = 881, 2, ..., n<
In[53]:=
MaximalPartition @n_D := 8Range@nD<
é Example: generate the maximal set partition of order 12
In[54]:=
Out[54]=
MaximalPartition @12D
881, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12<<
ì SetPartitions: enumerates all of the set partitions associated
with a particular integer n, namely all set partitions of
81, 2, ..., n<; this is a built-in Mathematica function
é Example:
In[55]:=
Out[55]=
SetPartitions @3D
8881, 2, 3<<, 881<, 82, 3<<, 881, 2<, 83<<, 881, 3<, 82<<, 881<, 82<, 83<<<
é Example: same example with grid display
In[56]:=
Out[56]=
Grid@SetPartitions @3D, Frame ® AllD
81, 2, 3<
81<
82, 3<
81, 2<
83<
81, 3<
82<
81<
82<
83<
é Example: to obtain the number of partitions in the same example
In[57]:=
Out[57]=
Length@SetPartitions @3DD
5
é Example: the singleton partition of order n is the last member of SetPartitions[n], which provides an alternative (but slower) way
to generate the singleton partition
In[58]:=
Out[58]=
Last ž SetPartitions @8D
881<, 82<, 83<, 84<, 85<, 86<, 87<, 88<<
It is much faster to generate the singleton partition using SingletonPartition.
In[59]:=
Out[59]=
SingletonPartition @8D
881<, 82<, 83<, 84<, 85<, 86<, 87<, 88<<
ì PiStar: generate a set partition of 81, 2, ..., n1 + ... + nk <, with k
blocks, the first of size n1 and the last of size nk
In[60]:=
PiStar@list_D := Module@8tot = Total@listD, ran,
control = Transpose@8Accumulate@Prepend@Drop@list, - 1D, 1DD, Accumulate@listD<D,
pistar<, ran = Range@totD;
pistar = Table@ran@@control@@i, 1DD ;; control@@i, 2DDDD, 8i, 1, Length ž control<DD
é Example: create a set partition P* with blocks of size 1, 2, 4, 7, and 9
In[61]:=
Out[61]=
PiStar@81, 2, 4, 7, 9<D
881<, 82, 3<, 84, 5, 6, 7<, 88, 9, 10, 11, 12, 13, 14<, 815, 16, 17, 18, 19, 20, 21, 22, 23<<
Operations with Set Partitions
ì Partition Intersection: finds the meet Σ ß Π between two set
partitions Σ and Π; each block of Σ ß Π is a non-empty
intersection between one block of Σ and one block of Π
In[62]:=
PartitionIntersection @A_, B_D ; Which@HSetPartitionQ @AD && SetPartitionQ @BDL,
True, HHSetPartitionQ @AD Š FalseL && HSetPartitionQ @BD Š TrueLL,
Message@PartitionIntersection ::badarg, AD; False,
HHSetPartitionQ @AD Š TrueL && HSetPartitionQ @BD Š FalseLL,
Message@PartitionIntersection ::badarg, BD; FalseD :=
If@Length@Flatten@ADD Š Length@Flatten@BDD, Select@ToCanonicalSetPartition @Flatten@Table@
HAPiTL Ý HBPjTL, 8i, 1, Length@AD<, 8j, 1, Length@BD<D, 1DD, Length@ð1D > 0 &D, "Error"D
é Example: find the meet between the set partitions {{1,4,5},{2},{3}} and {{1,2,5},{3},{4}}
In[63]:=
Out[63]=
PartitionIntersection @881, 4, 5<, 82<, 83<<, 881, 2, 5<, 83<, 84<<D
881, 5<, 82<, 83<, 84<<
é Example: if the partitions Σ and Π are not of the same order, then PartitionIntersection returns a message
In[64]:=
Out[64]=
PartitionIntersection @SingletonPartition @8D, 881, 2, 5, 6, 7<, 83<, 84<<D
Error
ì Partition Union: finds the join Σ Þ Π between two set partitions
Σ and Π; that is, the union of blocks of Σ and Π that have at
least one element in common
In[65]:=
PartitionUnion @x_, y_D ; Which@HSetPartitionQ @xD && SetPartitionQ @yDL,
True, HHSetPartitionQ @xD Š FalseL && HSetPartitionQ @yD Š TrueLL,
Message@PartitionUnion ::badarg, xD; False,
HHSetPartitionQ @xD Š TrueL && HSetPartitionQ @yD Š FalseLL,
Message@PartitionUnion ::badarg, yD; FalseD :=
Module@8<, Τ@a_, b_D := Select@Union@Flatten@Table@If@Intersection @a@@iDD, b@@jDDD Š 8<,
8<, Union@a@@iDD, b@@jDDDD, 8i, 1, Length@aD<, 8j, 1, Length@bD<D, 1DD,
Length@ðD > 0 &D; Β = Τ@x, yD; ToCanonicalSetPartition ž Union@
Table@Union@Flatten@Pick@Β, Table@If@Intersection @Β@@iDD, Β@@jDDD Š 8<, False, TrueD,
8i, 1, Length@ΒD<, 8j, 1, Length@ΒD<D@@kDDDDD, 8k, 1, Length@ΒD<DDD
é Example: find the join between the set partitions {{1,4,5},{2},{3}} and {{1,2,5},{3},{4}}
In[66]:=
Out[66]=
PartitionUnion @881, 4, 5<, 82<, 83<<, 881, 2, 5<, 83<, 84<<D
881, 2, 4, 5<, 83<<
é Example: find the join between the set partitions {{1},{2},{3},{4},{5},{6}} and {{1,2,5},{3},{4}}
In[67]:=
Out[67]=
PartitionUnion @SingletonPartition @6D, 881, 2, 5<, 83<, 84<<D
881, 2, 5<, 83<, 84<<
Notice that the union of these two set partitions is well-defined even though the two set partitions are of different order.
é Example: find the join between the set partitions {{1,2,3,4,5,6}} and {{1,2,5},{3},{4}}
In[68]:=
PartitionUnion @881, 2, 3, 4, 5, 6<<, 881, 2, 5<, 83<, 84<<D
Out[68]=
881, 2, 3, 4, 5, 6<<
In[69]:=
881, 2, 3, 4, 5, 6<<
Out[69]=
881, 2, 3, 4, 5, 6<<
Again, the union of these two set partitions is well-defined, even though the two set partitions are of different order.
ì MeetSolve: for a fixed set partition Π, find all set partitions Σ
`
such that the meet of Π and Σ is the singleton partition 0, that
`
is, Σ ß Π = 0
In[70]:=
MeetSolve@P_D ; If@SetPartitionQ @PD, True, Message@MeetSolve::badarg, PD; FalseD :=
Module@8A, B<, A = Table@PartitionIntersection @SetPartitions @Length@Flatten@PDDD@@iDD, PD,
8i, 1, Length@SetPartitions @Length@Flatten@PDDDD<D;
B = Table@If@Length@A@@iDDD Š Length@Flatten@PDD, True, FalseD, 8i, 1, Length@AD<D;
K = Pick@SetPartitions @Length@Flatten@PDDD, BD;
Print@StringJoin@"Number of Solutions to Meet Problem = ", ToString@Length@KDDDD; KD
é Example: an error message is thrown if the input to MeetSolve is not a set partition
In[71]:=
MeetSolve@81, 2, 3, 4<D
MeetSolve::badarg : Set partition expected. Invalid argument 81, 2, 3, 4<.
Out[71]=
MeetSolve@81, 2, 3, 4<D
`
é Example: find all set partitions Σ such that the meet of Σ and {{1,4,5},{2},{3}} is the singleton partition 0
In[72]:=
MeetSolve@881, 4, 5<, 82<, 83<<D
Number of Solutions to Meet Problem = 17
Out[72]=
In[73]:=
Out[73]=
8881<, 82, 3, 4<, 85<<, 881<, 82, 5<, 83, 4<<, 881<, 82, 3, 5<, 84<<, 881<, 82, 4<, 83, 5<<,
881, 2<, 83, 4<, 85<<, 881, 2<, 83, 5<, 84<<, 881, 2, 3<, 84<, 85<<, 881, 3<, 82, 4<, 85<<,
881, 3<, 82, 5<, 84<<, 881<, 82<, 83, 4<, 85<<, 881<, 82<, 83, 5<, 84<<,
881<, 82, 3<, 84<, 85<<, 881<, 82, 4<, 83<, 85<<, 881<, 82, 5<, 83<, 84<<,
881, 2<, 83<, 84<, 85<<, 881, 3<, 82<, 84<, 85<<, 881<, 82<, 83<, 84<, 85<<<
PartitionIntersection @881, 4, 5<, 82<, 83<<, 881<, 82, 5<, 83<, 84<<D
881<, 82<, 83<, 84<, 85<<
ì JoinSolve: for a fixed set partition Π, find all set partitions Σ
`
such that the join of Π and Σ is the maximal partition 1, that is,
`
ΣÞΠ = 1
In[74]:=
JoinSolve@P_D ; If@SetPartitionQ @PD, True, Message@JoinSolve::badarg, PD; FalseD :=
Module@8A, B<, A = Table@PartitionUnion @SetPartitions @Length@Flatten@PDDD@@iDD, PD,
8i, 1, Length@SetPartitions @Length@Flatten@PDDDD<D;
B = Table@If@Length@A@@iDDD Š 1, True, FalseD, 8i, 1, Length@AD<D;
K = Pick@SetPartitions @Length@Flatten@PDDD, BD;
Print@StringJoin@"Number of Solutions to Join Problem = ", ToString@Length@KDDDD; KD
`
é Example: find all set partitions Σ such that the join of Σ and {{1,4,5},{2},{3}} is the maximal partition 1
In[75]:=
JoinSolve@881, 4, 5<, 82<, 83<<D
Number of Solutions to Join Problem = 22
Out[75]=
8881, 2, 3, 4, 5<<, 881<, 82, 3, 4, 5<<, 881, 2<, 83, 4, 5<<, 881, 2, 3<, 84, 5<<,
881, 3<, 82, 4, 5<<, 881, 2, 3, 4<, 85<<, 881, 5<, 82, 3, 4<<, 881, 2, 5<, 83, 4<<,
881, 3, 4<, 82, 5<<, 881, 2, 3, 5<, 84<<, 881, 4<, 82, 3, 5<<, 881, 2, 4<, 83, 5<<,
881, 3, 5<, 82, 4<<, 881<, 82, 3, 4<, 85<<, 881<, 82, 5<, 83, 4<<, 881<, 82, 3, 5<, 84<<,
881<, 82, 4<, 83, 5<<, 881, 2<, 83, 4<, 85<<, 881, 2<, 83, 5<, 84<<,
881, 2, 3<, 84<, 85<<, 881, 3<, 82, 4<, 85<<, 881, 3<, 82, 5<, 84<<<
ì JoinSolveGrid: display the output of JoinSolve in a grid
In[76]:=
JoinSolveGrid @P_D ; If@SetPartitionQ @PD, True, Message@GridJoinSolve ::badarg, PD; FalseD :=
Grid@ð, Frame ® AllD & ž HJoinSolve@PDL
`
é Example: find all set partitions Σ such that the join of Σ and {{1,2},{3,4}} is the maximal partition 1
In[77]:=
JoinSolveGrid @881, 2<, 83, 4<<D
Number of Solutions to Join Problem = 11
Out[77]=
81, 2, 3, 4<
81<
82, 3, 4<
81, 3, 4<
82<
81, 2, 3<
84<
81, 4<
82, 3<
81, 2, 4<
83<
81, 3<
82, 4<
81<
82, 3<
81<
82, 4<
81, 3<
82<
81, 4<
82<
84<
83<
84<
83<
ì MeetAndJoinSolve: for a fixed set partition Π, finds all set
partitions Σ such that the join of Π and Σ is the maximal
`
`
partition 1 AND the meet of Π and Σ is the singleton partition 0,
`
`
that is, Σ ß Π = 0 and Σ Þ Π = 1
In[78]:=
MeetAndJoinSolve @P_D ;
If@SetPartitionQ @PD, True, Message@MeetAndJoinSolve ::badarg, PD; FalseD :=
Module@8z, A, B, K<, z = MeetSolve@PD;
A = Table@PartitionUnion @z@@iDD, PD, 8i, 1, Length@zD<D;
B = Table@If@Length@A@@iDDD Š 1, True, FalseD, 8i, 1, Length@AD<D; K = Pick@z, BD;
Print@StringJoin@"Number of Solutions to Meet and Join Problem = ",
ToString@Length@KDDDD; KD
`
é Example: find all set partitions Σ such that the join of Σ and {{1,4,5},{2},{3}} is the maximal partition 1 and such that the meet of Σ
`
and {{1,4,5},{2},{3}} is the singleton partition 0, with timing
`
Example: find all set partitions Σ such that the join of Σ and {{1,4,5},{2},{3}} is the maximal partition 1 and such that the meet of Σ
`
and {{1,4,5},{2},{3}} is the singleton partition 0, with timing
In[79]:=
MeetAndJoinSolve @881, 4, 5<, 82<, 83<<D  AbsoluteTiming
Number of Solutions to Meet Problem = 17
Number of Solutions to Meet and Join Problem = 9
Out[79]=
80.0937500, 8881<, 82, 3, 4<, 85<<, 881<, 82, 5<, 83, 4<<, 881<, 82, 3, 5<, 84<<,
881<, 82, 4<, 83, 5<<, 881, 2<, 83, 4<, 85<<, 881, 2<, 83, 5<, 84<<,
881, 2, 3<, 84<, 85<<, 881, 3<, 82, 4<, 85<<, 881, 3<, 82, 5<, 84<<<<
The output in the first position is the number of seconds it took to generate the rest of the output.
ì CoarserSetPartitionQ: this is a built-in Mathematica function;
CoarserSetPartitionQ[Σ,Π] yields "True" if the set partition Π is
coarser than the set partition Σ; that is, if Σ £ Π, i.e., if every
block in Σ is contained in a block of Π
é Example: is the set partition Π = 881, 2<, 83, 4<, 85<< coarser than the set partition Σ = 881, 2, 3, 4<, 85<<?
In[80]:=
Out[80]=
CoarserSetPartitionQ @881, 2, 3, 4<, 85<<, 881, 2<, 83, 4<, 85<<D
False
é Example: is the set partition Π = 881, 2, 3, 4<, 85<< coarser than the set partition Σ = 881, 2<, 83, 4<, 85<<?
In[81]:=
Out[81]=
CoarserSetPartitionQ @881, 2<, 83, 4<, 85<<, 881, 2, 3, 4<, 85<<D
True
ì CoarserThan: for a fixed set partition Π, find all set partitions Σ
such that Σ ³ Π, i.e., all set partitions such that every block of Π
is fully contained in some block of Σ
In[82]:=
CoarserThan@P_D ;
If@SetPartitionQ @PD, True, Message@MomentProductToCumulants ::badarg, PD; FalseD :=
Module@8size = Length@Flatten@PDD, scan, group<, group = SetPartitions @sizeD;
scan = CoarserSetPartitionQ @P, ðD & ž group; Pick@group, scanDD
é Example: find all of the set partitions Σ such that Σ ³ 881, 2<, 83, 4<, 85<<
In[83]:=
Out[83]=
é
CoarserThan@881, 2<, 83, 4<, 85<<D
8881, 2, 3, 4, 5<<, 881, 2<, 83, 4, 5<<,
881, 2, 3, 4<, 85<<, 881, 2, 5<, 83, 4<<, 881, 2<, 83, 4<, 85<<<
Partition Segments
Partition Segments
ì PartitionSegment: for set partitions Σ and Π, find all set
partitions Ρ such that Σ £ Ρ £ Π
In[84]:=
PartitionSegment @P_, Q_D ;
If@SetPartitionQ @PD, True, Message@MomentProductToCumulants ::badarg, PD; FalseD :=
Module@8size = Length@Flatten@PDD, scan, group, output<, group = SetPartitions @sizeD;
scan = HCoarserSetPartitionQ @P, ðD && CoarserSetPartitionQ @ð, QDL & ž group;
output = Pick@group, scanD;
Print@"Number of partitions in the segment = " <> ToString@Length@outputDDD; outputD
é Example: find all of the set partitions Ρ such that 881<, 82<, 83<, 84, 5<< = Σ £ Ρ £ Π = 881, 2, 3<, 84, 5<<
In[85]:=
PartitionSegment @881<, 82<, 83<, 84, 5<<, 881, 2, 3<, 84, 5<<D
Number of partitions in the segment = 5
Out[85]=
8881, 2, 3<, 84, 5<<, 881<, 82, 3<, 84, 5<<,
881, 2<, 83<, 84, 5<<, 881, 3<, 82<, 84, 5<<, 881<, 82<, 83<, 84, 5<<<
é Example: find all of the set partitions Ρ such that 881, 2, 3<, 84, 5<< = Σ £ Ρ £ Π = 881<, 82<, 83<, 84, 5<<
In[86]:=
PartitionSegment @881, 2, 3<, 84, 5<<, 881<, 82<, 83<, 84, 5<<D
Number of partitions in the segment = 0
Out[86]=
8<
The output is null because, in this example, we do not have Σ £ Π.
ì ClassSegment: for set partitions Σ and Π, with Σ £ Π, obtain the
"class segment," ΛHΣ, ΠL = I1r1 2r2 ... Σ r Σ M, where ri is the
number of blocks of Π that contain exactly i blocks of Σ (terms
with exponent zero are ignored in the output)
In[87]:=
ClassSegment @S_, P_D := If@CoarserSetPartitionQ @S, PD,
Row@Join@8"H"<, Superscript@ð@@1DD, ToString@ð@@2DDDD & ž Sort@Tally@
Length@ðD & ž HSelect@ð, Length@ððD > 0 &D & ž Table@Intersection @P@@iDD, S@@jDDD,
8i, 1, Length ž P<, 8j, 1, Length ž S<DLDD, 8"L"<DD, "Π is not coarser than Σ."D
é Example: compute the class segment when Σ = 881, 2<, 83<, 84, 5<< and Π = 881, 2, 3<, 84, 5<<
In[88]:=
Out[88]=
ClassSegment @881, 2<, 83<, 84, 5<<, 881, 2, 3<, 84, 5<<D
H11 21 L
This is because only one block of Π (namely, 84, 5<) contains one block of Σ and one block of Π (namely, 81, 2, 3<) contains two
blocks of Σ. The answer could be more fully written as I11 21 30 M.
This is because only one block of Π (namely, 84, 5<) contains one block of Σ and one block of Π (namely, 81, 2, 3<) contains two
blocks of Σ. The answer could be more fully written as I11 21 30 M.
é Example: if Π is not coarser than Σ, a message is returned
In[89]:=
Out[89]=
ClassSegment @881, 2, 3<, 84, 5<<, 881, 2<, 83<, 84, 5<<D
Π is not coarser than Σ.
é Example: compute the class segment when Σ = 881, 2<, 83<, 84, 5<, 86<, 87<, 88<, 89<, 810<, 811<< and
Π = 881, 2, 3<, 84, 5<, 86, 7, 8<, 89, 10, 11<<
In[90]:=
Out[90]=
ClassSegment @881, 2<, 83<, 84, 5<, 86<, 87<, 88<, 89<, 810<, 811<<,
881, 2, 3<, 84, 5<, 86, 7, 8<, 89, 10, 11<<D
H11 21 32 L
Note that the exponent of 3 is 2 because there are three blocks of Σ are contained in two blocks of Π.
ì ClassSegmentSolve: given a partition Σ, find all coarser
partitions Π with a specific class segment
ΛHΣ, ΠL = I1r1 2r2 ... Σ r Σ M written as 981, r1<, 82, r2<, ..., 9 Σ , r Σ ==
with ri ³ 0 or merely ri > 0. We want ri blocks of Π to contain
exactly i blocks of Σ, for i = 1, ..., n
In[91]:=
ClassSegmentSolve @S_, list_D :=
Block@8totalspace = CoarserThan@SD, outputs, reducedlist, final<,
outputs = 8ð, Sort@Tally@Length@ðD & ž HSelect@ð, Length@ððD > 0 &D & ž
Table@Intersection @ð@@iDD, S@@jDDD, 8i, 1, Length ž ð<, 8j, 1, Length ž S<DLDD< & ž
totalspace; reducedlist = Select@list, ð@@2DD > 0 &D; final =
First ž HSelect@outputs, ð@@2DD === reducedlist &DL;
Print@"Number of solutions = " <> ToString@Length@finalDDD; finalD
é Input format: ClassSegmentSolve[Σ, Λ(Σ,Π)]
é Example: find the set of all partitions Π such that the class segment of Σ = 881, 2<, 83<, 84, 5<< and Π is equal to ΛHΣ, ΠL = I11 21 M. We
want r1 = 1 block of Π to contain one block of Σ and r2 = 1 block of Π to contain two blocks of Σ.
In[92]:=
ClassSegmentSolve @881, 2<, 83<, 84, 5<<, 881, 1<, 82, 1<<D
Number of solutions = 3
Out[92]=
8881, 2<, 83, 4, 5<<, 881, 2, 3<, 84, 5<<, 881, 2, 4, 5<, 83<<<
If Π = 881, 2<, 83, 4, 5<<, then 81, 2< contains the block 81, 2< in Σ = 881, 2<, 83<, 84, 5<< and 83, 4, 5< contains the blocks 83< and
84, 5< of Σ.
To use ClassSegmentSolve, we could also have added the zero exponent, since I11 21 M = I11 21 30 M, as follows:
In[93]:=
ClassSegmentSolve @881, 2<, 83<, 84, 5<<, 881, 1<, 82, 1<, 83, 0<<D
Number of solutions = 3
Out[93]=
8881, 2<, 83, 4, 5<<, 881, 2, 3<, 84, 5<<, 881, 2, 4, 5<, 83<<<
Let us check that 881, 2<, 83, 4, 5<< gives the specific class segment, namely, I11 21 M:
In[94]:=
Out[94]=
ClassSegment @881, 2<, 83<, 84, 5<<, 881, 2<, 83, 4, 5<<D
H11 21 L
Check that, in fact, all of the solutions to ClassSegmentSolve give the specific class segment I11 21 M:
In[95]:=
ClassSegment @881, 2<, 83<, 84, 5<<, ðD & ž
ClassSegmentSolve @881, 2<, 83<, 84, 5<<, 881, 1<, 82, 1<<D
Number of solutions = 3
Out[95]=
9H11 21 L, H11 21 L, H11 21 L=
é Example: when ri is too large, there is no solution
In[96]:=
ClassSegmentSolve @881, 2<, 83<, 84, 5<<, 881, 1<, 82, 6<, 83, 0<<D
Number of solutions = 0
Out[96]=
8<
Example: This next example involves a singleton partition Σ with Σ = 7. The goal is to find all coarser partitions Π such that
ΛHΣ, ΠL = I11 23 M; that is, such that r1 = 1 block of Π contains one block of Σ and r2 = 3 blocks of Π contain two blocks of Σ.
In[97]:=
ClassSegmentSolve @881<, 82<, 83<, 84<, 85<, 86<, 87<<, 881, 1<, 82, 3<<D
Number of solutions = 105
Out[97]=
8881<, 82, 3<, 84, 5<, 86, 7<<,
881<, 82, 5<, 83, 4<, 86, 7<<,
881<, 82, 4<, 83, 7<, 85, 6<<,
881<, 82, 7<, 83, 6<, 84, 5<<,
881<, 82, 5<, 83, 7<, 84, 6<<,
881, 2<, 83<, 84, 5<, 86, 7<<,
881, 3<, 82<, 84, 7<, 85, 6<<,
881, 2<, 83, 4<, 85<, 86, 7<<,
881, 4<, 82<, 83, 5<, 86, 7<<,
881, 2<, 83, 7<, 84<, 85, 6<<,
881, 6<, 82<, 83, 4<, 85, 7<<,
881, 2<, 83, 6<, 84, 5<, 87<<,
881, 6<, 82<, 83, 7<, 84, 5<<,
881, 2<, 83, 7<, 84, 6<, 85<<,
881, 6<, 82<, 83, 5<, 84, 7<<,
881, 4<, 82, 3<, 85<, 86, 7<<,
881, 5<, 82, 4<, 83<, 86, 7<<,
881, 4<, 82, 3<, 85, 6<, 87<<,
881, 7<, 82, 4<, 83<, 85, 6<<,
881, 4<, 82, 3<, 85, 7<, 86<<,
881, 6<, 82, 4<, 83<, 85, 7<<,
881, 6<, 82, 3<, 84, 5<, 87<<,
881, 7<, 82, 6<, 83<, 84, 5<<,
881, 5<, 82, 3<, 84, 6<, 87<<,
881, 7<, 82, 5<, 83<, 84, 6<<,
881, 5<, 82, 3<, 84, 7<, 86<<,
881, 6<, 82, 5<, 83<, 84, 7<<,
881, 6<, 82, 5<, 83, 4<, 87<<,
881, 7<, 82, 6<, 83, 4<, 85<<,
881, 6<, 82, 4<, 83, 5<, 87<<,
881, 7<, 82, 6<, 83, 5<, 84<<,
881, 5<, 82, 4<, 83, 6<, 87<<,
881, 7<, 82, 5<, 83, 6<, 84<<,
881, 5<, 82, 4<, 83, 7<, 86<<,
881, 6<, 82, 5<, 83, 7<, 84<<,
881<, 82, 3<, 84, 7<, 85, 6<<,
881<, 82, 4<, 83, 5<, 86, 7<<,
881<, 82, 6<, 83, 4<, 85, 7<<,
881<, 82, 6<, 83, 7<, 84, 5<<,
881<, 82, 6<, 83, 5<, 84, 7<<,
881, 3<, 82<, 84, 5<, 86, 7<<,
881, 2<, 83<, 84, 6<, 85, 7<<,
881, 5<, 82<, 83, 4<, 86, 7<<,
881, 2<, 83, 4<, 85, 6<, 87<<,
881, 4<, 82<, 83, 7<, 85, 6<<,
881, 2<, 83, 6<, 84<, 85, 7<<,
881, 7<, 82<, 83, 6<, 84, 5<<,
881, 2<, 83, 5<, 84, 6<, 87<<,
881, 5<, 82<, 83, 7<, 84, 6<<,
881, 2<, 83, 6<, 84, 7<, 85<<,
881, 5<, 82, 3<, 84<, 86, 7<<,
881, 3<, 82, 5<, 84<, 86, 7<<,
881, 7<, 82, 3<, 84<, 85, 6<<,
881, 3<, 82, 7<, 84<, 85, 6<<,
881, 6<, 82, 3<, 84<, 85, 7<<,
881, 3<, 82, 6<, 84<, 85, 7<<,
881, 7<, 82, 3<, 84, 5<, 86<<,
881, 3<, 82, 7<, 84, 5<, 86<<,
881, 7<, 82, 3<, 84, 6<, 85<<,
881, 3<, 82, 7<, 84, 6<, 85<<,
881, 6<, 82, 3<, 84, 7<, 85<<,
881, 3<, 82, 6<, 84, 7<, 85<<,
881, 7<, 82, 5<, 83, 4<, 86<<,
881, 5<, 82, 7<, 83, 4<, 86<<,
881, 7<, 82, 4<, 83, 5<, 86<<,
881, 4<, 82, 7<, 83, 5<, 86<<,
881, 7<, 82, 4<, 83, 6<, 85<<,
881, 4<, 82, 7<, 83, 6<, 85<<,
881, 6<, 82, 4<, 83, 7<, 85<<,
881, 4<, 82, 6<, 83, 7<, 85<<,
881<, 82, 3<, 84, 6<, 85, 7<<,
881<, 82, 7<, 83, 4<, 85, 6<<,
881<, 82, 4<, 83, 6<, 85, 7<<,
881<, 82, 7<, 83, 5<, 84, 6<<,
881<, 82, 5<, 83, 6<, 84, 7<<,
881, 2<, 83<, 84, 7<, 85, 6<<,
881, 3<, 82<, 84, 6<, 85, 7<<,
881, 2<, 83, 5<, 84<, 86, 7<<,
881, 7<, 82<, 83, 4<, 85, 6<<,
881, 2<, 83, 4<, 85, 7<, 86<<,
881, 4<, 82<, 83, 6<, 85, 7<<,
881, 2<, 83, 7<, 84, 5<, 86<<,
881, 7<, 82<, 83, 5<, 84, 6<<,
881, 2<, 83, 5<, 84, 7<, 86<<,
881, 5<, 82<, 83, 6<, 84, 7<<,
881, 3<, 82, 4<, 85<, 86, 7<<,
881, 4<, 82, 5<, 83<, 86, 7<<,
881, 3<, 82, 4<, 85, 6<, 87<<,
881, 4<, 82, 7<, 83<, 85, 6<<,
881, 3<, 82, 4<, 85, 7<, 86<<,
881, 4<, 82, 6<, 83<, 85, 7<<,
881, 3<, 82, 6<, 84, 5<, 87<<,
881, 6<, 82, 7<, 83<, 84, 5<<,
881, 3<, 82, 5<, 84, 6<, 87<<,
881, 5<, 82, 7<, 83<, 84, 6<<,
881, 3<, 82, 5<, 84, 7<, 86<<,
881, 5<, 82, 6<, 83<, 84, 7<<,
881, 5<, 82, 6<, 83, 4<, 87<<,
881, 6<, 82, 7<, 83, 4<, 85<<,
881, 4<, 82, 6<, 83, 5<, 87<<,
881, 6<, 82, 7<, 83, 5<, 84<<,
881, 4<, 82, 5<, 83, 6<, 87<<,
881, 5<, 82, 7<, 83, 6<, 84<<,
881, 4<, 82, 5<, 83, 7<, 86<<,
881, 5<, 82, 6<, 83, 7<, 84<<<
ì SquareChoose: for a list of integers 8r1, ..., rk < with
1 r1 + 2 r2 + ... + k rk = n, compute
n!
In[98]:=
SquareChoose @list_D :=
H1!Lr1 Hr1 L! H2!Lr2 Hr2 L!... Hk!Lrk Hrk L!
BlockA9numerator = HSum@i list@@iDD, 8i, 1, Length ž list<DL !, denominator =
ProductAHi !Llist@@iDD Hlist@@iDDL !, 8i, 1, Length ž list<E=, numerator  denominatorE
é Example: compute
In[99]:=
Out[99]=
7!
H1!L1 H1!L H2!L3 H3!L
SquareChoose @81, 3, 0, 0, 0, 0, 0, 0<D
105
This number is equal to the number of solutions to the function ClassSegmentSolve with Σ = 881<, 82<, 83<, 84<< and
ΛHΣ, ΠL = Λ = I11 23 M. The answer to SquareChoose is denoted
n
B F.
Λ
Mobius Formula
ì MobiusFunction: for a set partition Σ £ Π, compute the Mobius
function
ΜHΣ, ΠL = H-1Ln-r H2!Lr3 H3!Lr4 ... HHn - 1L!Lrn
where n = Σ , r = Π , and ΛHΣ, ΠL = I1r1 2r2 ... Σ
rΣ
M is there corresponding class segment;
that is, there are exactly ri blocks of Π containing exactly i blocks of Σ, i = 1, ..., n.
In[100]:=
MobiusFunction @S_, P_D :=
IfACoarserSetPartitionQ @S, PD, BlockA8classsegmentraw , r = Length@PD, n = Length@SD<,
classsegment = Sort@Tally@Length@ðD & ž HSelect@ð, Length@ððD > 0 &D & ž
Table@Intersection @P@@iDD, S@@jDDD, 8i, 1, Length ž P<, 8j, 1, Length ž S<DLDD;
classsegmentone = First ž classsegment ; classsegmenttwo = Last ž classsegment ;
missing = Transpose@8Complement@Range@nD, classsegmentone D,
Table@0, 8Length ž Complement@Range@nD, classsegmentone D<D<D;
complete = Sort@Join@classsegment , missingDD;
H- 1Ln-r ProductAHj !LHLastžcompleteL@@j+1DD , 8j, 0, n - 1<EE, "Π is not coarser than Σ."E
ì
Input format: MobiusFunction[Σ,Π]
é Example: evaluation of the Mobius function
In[101]:=
Out[101]=
MobiusFunction @881<, 82<, 83, 4<, 85, 6<, 87<, 88, 9<<, 881, 2<, 83, 4, 5, 6, 7, 8, 9<<D
6
Let's check this result with ClassSegment.
In[102]:=
Out[102]=
ClassSegment @881<, 82<, 83, 4<, 85, 6<, 87<, 88, 9<<, 881, 2<, 83, 4, 5, 6, 7, 8, 9<<D
H21 41 L
Thus, r2 = 1, r4 = 1, n = 6, r = 2 which explains why ΜHΣ, ΠL = H-1L6-2 H3 !L1 = 6.
é Example: the Mobius function of any set partition with itself is always equal to 1
Example: the Mobius function of any set partition with itself is always equal to 1
In[103]:=
Out[103]=
MobiusFunction @881, 2<, 83<, 84, 5<<, 881, 2<, 83<, 84, 5<<D
1
`
`
é Example: the Mobius function of the singleton partition 0 = 881<, ..., 8n<< with the maximal partition 1 = 881, 2, ..., n<< is equal to
H-1Ln-1 Hn - 1L !, where n is the order of the set partition
In[104]:=
Out[104]=
MobiusFunction @881<, 82<, 83<, 84<, 85<<, 881, 2, 3, 4, 5<<D
24
é Example: the output can be negative
In[105]:=
Out[105]=
MobiusFunction @881<, 82<, 83<, 84<<, 881, 2, 3, 4<<D
-6
é Example: with Σ > Π
In[106]:=
Out[106]=
MobiusFunction @881, 2, 3, 4<<, 881<, 82<, 83<, 84<<D
Π is not coarser than Σ.
ì MobiusRecursionCheck: verify that the Mobius function
recursion ΜHΣ, ΠL = - ÚΣ£Ρ<Π ΜHΣ, ΡL holds; in the output, the
number in the first coordinate is ΜHΣ, ΠL and the number in the
second coordinate is - ÚΣ£Ρ<Π ΜHΣ, ΡL; they should be equal
In[107]:=
MobiusRecursionCheck @S_, P_D := 8MobiusFunction @S, PD, Block@
8initial = Drop@PartitionSegment @S, PD, 1D<, - Total ž HMobiusFunction @S, ðD & ž initialLD<
é Example: check the Mobius function recursion when Σ = 881<, 82<, 83<, 84<< and Π = 881, 2, 3, 4<<
In[108]:=
MobiusRecursionCheck @881<, 82<, 83<, 84<<, 881, 2, 3, 4<<D
Number of partitions in the segment = 15
Out[108]=
8- 6, - 6<
é Example: check the Mobius function recursion when Σ = 881<, 82<, 83<, 84, 5<< and Π = 881, 2, 3<, 84, 5<<
In[109]:=
MobiusRecursionCheck @881<, 82<, 83<, 84, 5<<, 881, 2, 3<, 84, 5<<D
Number of partitions in the segment = 5
Out[109]=
82, 2<
ì
MobiusInversionFormulaZero: compute the Mobius inversion
é
formula, which is given by FHΠL = Ú0` £Σ£Π ΜHΣ, ΠL GHΣL, where F
and G are functions taking set partitions as their arguments
MobiusInversionFormulaZero: compute the Mobius inversion
formula, which is given by FHΠL = Ú0` £Σ£Π ΜHΣ, ΠL GHΣL, where F
and G are functions taking set partitions as their arguments
In[110]:=
MobiusInversionFormulaZero @P_D :=
Block@8segment = PartitionSegment @SingletonPartition @Length@Flatten@PDDD, PD, G<, Grid@
Join@88"Σ", "ΜHΣ,ΠL", "GHΣL"<<, 8ð, MobiusFunction @ð, PD, G@ðD< & ž segmentD, Frame ® AllDD
é Input format: MobiusInversionFormulaZero[Π]
`
é Example: for all 0 £ Σ £ Π, obtain the Mobius function coefficient ΜHΣ, ΠL and print GHΣL
In[111]:=
MobiusInversionFormulaZero @881, 2, 3<, 84, 5<<D
Number of partitions in the segment = 10
Out[111]=
Σ
ΜHΣ,ΠL
GHΣL
881, 2, 3<, 84, 5<<
1
G@881, 2, 3<, 84, 5<<D
881<, 82, 3<, 84, 5<<
-1
G@881<, 82, 3<, 84, 5<<D
881, 2<, 83<, 84, 5<<
-1
G@881, 2<, 83<, 84, 5<<D
881, 3<, 82<, 84, 5<<
-1
G@881, 3<, 82<, 84, 5<<D
881, 2, 3<, 84<, 85<<
-1
G@881, 2, 3<, 84<, 85<<D
881<, 82<, 83<, 84, 5<<
2
G@881<, 82<, 83<, 84, 5<<D
881<, 82, 3<, 84<, 85<<
1
G@881<, 82, 3<, 84<, 85<<D
881, 2<, 83<, 84<, 85<<
1
G@881, 2<, 83<, 84<, 85<<D
881, 3<, 82<, 84<, 85<<
1
G@881, 3<, 82<, 84<, 85<<D
881<, 82<, 83<, 84<, 85<<
-2
G@881<, 82<, 83<, 84<, 85<<D
For example, if G º 1, then FHΠL = Ú0` £Σ£Π ΜHΣ, ΠL = 0.
The function MobiusInversionFormulaZero is also useful for computing
GHΠL = Ú0` £Σ£Π FHΣL.
`
Merely ignore ΜHΣ, ΠL and replace GHΣL by FHΣL. Observe that the list of partitions Σ satisfying 0 £ Σ < Π can also be obtained
by using the function PartitionSegment[{{1},{2},{3},{4},{5},{{1,2,3},{4,5}}]. For the preceding example,
In[112]:=
PartitionSegment @SingletonPartition @5D, 881, 2, 3<, 84, 5<<D
Number of partitions in the segment = 10
Out[112]=
8881, 2, 3<, 84, 5<<, 881<, 82, 3<, 84, 5<<, 881, 2<, 83<, 84, 5<<, 881, 3<, 82<, 84, 5<<,
881, 2, 3<, 84<, 85<<, 881<, 82<, 83<, 84, 5<<, 881<, 82, 3<, 84<, 85<<,
881, 2<, 83<, 84<, 85<<, 881, 3<, 82<, 84<, 85<<, 881<, 82<, 83<, 84<, 85<<<
ì MobiusInversionFormulaOne: compute the Mobius inversion
formula, which is given by FHΠL = ÚΠ£Σ£1` ΜHΠ, ΣL GHΣL, where F
ì and G are functions taking set partitions as their arguments
MobiusInversionFormulaOne: compute the Mobius inversion
formula, which is given by FHΠL = ÚΠ£Σ£1` ΜHΠ, ΣL GHΣL, where F
and G are functions taking set partitions as their arguments
In[113]:=
MobiusInversionFormulaOne @P_D :=
Block@8segment = PartitionSegment @P, MaximalPartition @Length@Flatten@PDDDD, G<,
Print ž segment; Grid@
Join@88"Σ", "ΜHΣ,ΠL", "GHΣL"<<, 8ð, MobiusFunction @P, ðD, G@ðD< & ž segmentD, Frame ® AllDD
é Input format: MobiusInversionFormulaOne[Π]
`
é Example: for all Π £ Σ £ 1, obtain the Mobius function coefficient ΜHΠ, ΣL and print GHΣL
In[114]:=
MobiusInversionFormulaOne @881, 2, 3<, 84, 5<<D
Number of partitions in the segment = 2
8881, 2, 3, 4, 5<<, 881, 2, 3<, 84, 5<<<
Out[114]=
Σ
ΜHΣ,ΠL
GHΣL
881, 2, 3, 4, 5<<
-1
G@881, 2, 3, 4, 5<<D
881, 2, 3<, 84, 5<<
1
G@881, 2, 3<, 84, 5<<D
For example, if G º 1, then FHΠL = ÚΠ£Σ£1` ΜHΠ, ΣL = 0.
The function MobiusInversionFormulaZero is also useful for computing
GHΠL = ÚΠ£Σ£1` GHΣL.
`
Merely ignore ΜHΠ, ΣL and replace GHΣL by FHΣL. Observe that the list of partitions Σ satisfying Π £ Σ £ 1 can also be obtained
by using the function PartitionSegment[{{1,2,3},{4,5}},{{1,2,3,4,5}}]. For the preceding example,
In[115]:=
PartitionSegment @881, 2, 3<, 84, 5<<, MaximalPartition @5DD
Number of partitions in the segment = 2
Out[115]=
ì
8881, 2, 3, 4, 5<<, 881, 2, 3<, 84, 5<<<
Moments and Cumulants
ì MomentToCumulants: express the moment of a random
variable in terms of the cumulants
In[116]:=
MomentToCumulants @m_D ;
If@HTrueQ@m ³ 0D && IntegerQ@mDL, True, Message@MomentToCumulants ::badarg, mD; FalseD :=
Block@8A = 8Table@1, 8m<D<, X, myRules<,
myRules = Table@Rule@Χ@X, 8Table@1, 8i<D<D, Χi @XDD, 8i, 1, m<D;
If@Length ž A Š 1, Block@8int = Length@Flatten@ADD, rules, setpartitions , Χ<,
rules = Table@i ® Flatten@AD@@iDD, 8i, 1, int<D; setpartitions =
SetPartitions @intD . rules; Total ž Table@Product@Χ@X, 8setpartitions @@i, jDD<D, 8j, 1,
Length@setpartitions @@iDDD<D, 8i, 1, Length ž setpartitions <DD, "Error"D . myRulesD
é Input format: to express E@X m D in terms of cumulants, use MomentToCumulants[m]
é Example: express the sixth moment of a random variable X in terms of cumulants
In[117]:=
Out[117]=
MomentToCumulants @6D
Χ1 @XD6 + 15 Χ1 @XD4 Χ2 @XD + 45 Χ1 @XD2 Χ2 @XD2 + 15 Χ2 @XD3 + 20 Χ1 @XD3 Χ3 @XD +
60 Χ1 @XD Χ2 @XD Χ3 @XD + 10 Χ3 @XD2 + 15 Χ1 @XD2 Χ4 @XD + 15 Χ2 @XD Χ4 @XD + 6 Χ1 @XD Χ5 @XD + Χ6 @XD
The input is EAX 6 E. In the output, Χ2 @X D is the second cumulant of X and Χ3 @X D2 is the second power of the third cumulant of X .
ì CumulantToMoments: express the cumulant of a random
variable in terms of moments
In[118]:=
CumulantToMoments @m_D ;
If@HTrueQ@m ³ 0D && IntegerQ@mDL, True, Message@CumulantToMoments ::badarg, mD; FalseD :=
BlockA8A = 8Table@1, 8m<D<, X, myRules<,
myRules = TableARuleAE@X, 8Table@1, 8i<D<D, EAXi EE, 8i, 1, m<E;
IfALength ž A Š 1, BlockA8int = Length@Flatten@ADD, rules, setpartitions , Χ, E<, rules =
Table@i ® Flatten@AD@@iDD, 8i, 1, int<D; setpartitions = SetPartitions @intD . rules;
Total ž TableAH- 1LLengthžsetpartitions@@iDD-1 HLength ž setpartitions @@iDD - 1L !
Product@E@X, 8setpartitions @@i, jDD<D, 8j, 1, Length@setpartitions @@iDDD<D,
8i, 1, Length ž setpartitions <EE, "Error"E . myRulesE ; HTrueQ@m ³ 0D && IntegerQ@mDL
é Input format: to express Χm @XD in terms of moments, use CumulantToMoments[m]
é Example: express the sixth cumulant of a random variable X in terms of moments
In[119]:=
CumulantToMoments @6D
- 120 E@XD6 + 360 E@XD4 EAX2 E - 270 E@XD2 EAX2 E + 30 EAX2 E - 120 E@XD3 EAX3 E +
2
Out[119]=
3
120 E@XD EAX2 E EAX3 E - 10 EAX3 E + 30 E@XD2 EAX4 E - 15 EAX2 E EAX4 E - 6 E@XD EAX5 E + EAX6 E
2
The input is Χ6 @X D. The output starts with -120 HE@X DL6 and ends with EAX 6 E.
ì MomentProductToCumulants: express the expected value of
the product of random variables X b, where b Í @nD, in terms of
the cumulants
In[120]:=
MomentProductToCumulants @X_, A_D :=
If@Length ž A Š 1, Block@8int = Length@Flatten@ADD, rules, setpartitions , Χ, myRules<,
rules = Table@i ® Flatten@AD@@iDD, 8i, 1, int<D;
myRules = Block@8field = Map@List, Drop@Subsets@Flatten@ADD, 1DD<,
Table@Rule@Χ@X, field@@iDDD, Χ@Times@Sequence žž HSubscript@X, ðD & ž field@@i, 1DDLDDD,
8i, 1, Length ž field<DD; setpartitions = SetPartitions @intD . rules;
Total ž Table@Product@Χ@X, 8setpartitions @@i, jDD<D, 8j, 1, Length@setpartitions @@iDDD<D,
8i, 1, Length ž setpartitions <D . myRulesD, "Error"D
é Example: express the expected value of X 881,2<< = X1 X2 in terms of cumulants
In[121]:=
Out[121]=
MomentProductToCumulants @X, 881, 2<<D
Χ@X1 D Χ@X2 D + Χ@X1 X2 D
The input is E@X1 X2 D.
ì CumulantVectorToMoments: express the cumulant of a
random vector Xb, where b Í @nD, in terms of moments
In[122]:=
CumulantVectorToMoments @X_, A_D :=
IfALength ž A Š 1, BlockA8int = Length@Flatten@ADD, rules, setpartitions , Χ, E, myRules<,
rules = Table@i ® Flatten@AD@@iDD, 8i, 1, int<D;
setpartitions = SetPartitions @intD . rules; myRules =
Block@8field = Map@List, Drop@Subsets@Flatten@ADD, 1DD<, Table@Rule@E@X, field@@iDDD,
E@Times@Sequence žž HSubscript@X, ðD & ž field@@i, 1DDLDDD, 8i, 1, Length ž field<DD;
Total ž TableAH- 1LLengthžsetpartitions@@iDD-1 HLength ž setpartitions @@iDD - 1L !
Product@E@X, 8setpartitions @@i, jDD<D, 8j, 1, Length@setpartitions @@iDDD<D,
8i, 1, Length ž setpartitions <E . myRulesE, "Error"E  FullSimplify
é Example: express the cumulant of X881,2<< = HX1 , X2 L, which is the covariance of X1 and X2 , in terms of moments
In[123]:=
Out[123]=
CumulantVectorToMoments @X, 881, 2<<D
- E@X1 D E@X2 D + E@X1 X2 D
The input is ΧHX1 X2 L.
é Example: express the cumulant of X881<,82<,83<< = HX1 , X2 , X3 L in terms of moments
In[124]:=
Out[124]=
CumulantVectorToMoments @X, 881, 2, 3<<D  Expand
2 E@X1 D E@X2 D E@X3 D - E@X1 X2 D E@X3 D - E@X2 D E@X1 X3 D - E@X1 D E@X2 X3 D + E@X1 X2 X3 D
é Example: express the cumulant of X881<,81<,81<< , which is the third cumulant of X1 , in terms of moments
In[125]:=
Out[125]=
CumulantVectorToMoments @X, 881, 1, 1<<D
2 E@X1 D3 - 3 E@X1 D EAX21 E + EAX31 E
The input is Χ@X1 , X1 , X1 D, which is equal to Χ3 @X1 D. The output reads 2 HE@X1 DL3 - 3 E@X1 D IE@X1 D2 M + EAX13 E. Same result as in
the example above, with X1 = X2 = X3 . This result can also be obtained by:
In[126]:=
Out[126]=
CumulantToMoments @3D
2 E@XD3 - 3 E@XD EAX2 E + EAX3 E
ì CumulantProductVectorToCumulantVectors: express the joint
cumulant of a random vector IX b1 , X b2 , ..., X bk M, where
8b1, b2, ..., bk < Í @nD, in terms of cumulants of random vectors
whose components are not products (Malyshev's formula)
In[127]:=
In[128]:=
NewJoinSolve @P_D ; If@SetPartitionQ @PD, True, Message@NewJoinSolve ::badarg, PD; FalseD :=
Module@8A, B, K<, A = Table@PartitionUnion @SetPartitions @Length@Flatten@PDDD@@iDD, PD,
8i, 1, Length@SetPartitions @Length@Flatten@PDDDD<D;
B = Table@If@Length@A@@iDDD Š 1, True, FalseD, 8i, 1, Length@AD<D;
K = Pick@SetPartitions @Length@Flatten@PDDD, BDD
CumulantProductVectorToCumulantVectors @X_, A_D ; If@SetPartitionQ @AD,
True, Message@CumulantProductVectorToCumulantVectors ::badarg, AD; FalseD :=
Block@8int = Length@Flatten@ADD, rules, setpartitions , Χ, myRules<,
rules = Table@i ® Flatten@AD@@iDD, 8i, 1, int<D;
myRules = Block@8field = Map@List, Drop@Subsets@Flatten@ADD, 1DD<,
Table@Rule@Χ@X, field@@iDDD, Χ@Sequence žž HSubscript@X, ðD & ž field@@i, 1DDLDD,
8i, 1, Length ž field<DD; setpartitions = NewJoinSolve @AD . rules;
Total ž Table@Product@Χ@X, 8setpartitions @@i, jDD<D, 8j, 1, Length@setpartitions @@iDDD<D,
8i, 1, Length ž setpartitions <D . myRulesD  FullSimplify
é Example: express the cumulants Χ@X1 X2 , X3 D in terms of cumulants of random vectors whose components are not products
In[129]:=
Out[129]=
CumulantProductVectorToCumulantVectors @X, 881, 2<, 83<<D
Χ@X2 D Χ@X1 , X3 D + Χ@X1 D Χ@X2 , X3 D + Χ@X1 , X2 , X3 D
The input is Χ@X1 X2 , X3 D.
é Example: express the cumulants Χ@X1 , X2 , X3 D in terms of cumulants of random vectors whose components are not products
In[130]:=
Out[130]=
CumulantProductVectorToCumulantVectors @X, 881<, 82<, 83<<D
Χ@X1 , X2 , X3 D
The input is Χ@X1 , X2 , X3 D, and so is the output.
é Example: express the cumulants Χ@X1 X2 X3 D in terms of cumulants of random vectors whose components are not products
In[131]:=
Out[131]=
CumulantProductVectorToCumulantVectors @X, 881, 2, 3<<D  Expand
Χ@X1 D Χ@X2 D Χ@X3 D + Χ@X3 D Χ@X1 , X2 D + Χ@X2 D Χ@X1 , X3 D + Χ@X1 D Χ@X2 , X3 D + Χ@X1 , X2 , X3 D
The input is Χ@X1 X2 X3 D. The qualifier Expand is used to avoid factoring terms. Without it, one gets
In[132]:=
Out[132]=
CumulantProductVectorToCumulantVectors @X, 881, 2, 3<<D
Χ@X3 D Χ@X1 , X2 D + Χ@X2 D Χ@X1 , X3 D + Χ@X1 D HΧ@X2 D Χ@X3 D + Χ@X2 , X3 DL + Χ@X1 , X2 , X3 D
To count the number of terms in a summation in this notebook, code like the following will work:
In[133]:=
Out[133]=
Length@StringSplit@
ToString@HCumulantProductVectorToCumulantVectors @X, 881, 2, 3<<D  ExpandLD, "+"DD
5
ì GridCumulantProductVectorToCumulantVectors: display the
output of CumulantProductVectorToCumulantVectors in a grid
In[134]:=
In[135]:=
NewJoinSolve @P_D ; If@SetPartitionQ @PD, True, Message@NewJoinSolve ::badarg, PD; FalseD :=
Module@8A, B, K<, A = Table@PartitionUnion @SetPartitions @Length@Flatten@PDDD@@iDD, PD,
8i, 1, Length@SetPartitions @Length@Flatten@PDDDD<D;
B = Table@If@Length@A@@iDDD Š 1, True, FalseD, 8i, 1, Length@AD<D;
K = Pick@SetPartitions @Length@Flatten@PDDD, BDD
GridCumulantProductVectorToCumulantVectors @X_, P_D ; If@SetPartitionQ @PD, True,
Message@GridCumulantProductVectorToCumulantVectors ::badarg, PD; FalseD :=
Block@8input = List žž HCumulantProductVectorToCumulantVectors @X, PD  ExpandL<,
Print@"Number of terms in summation = " <> ToString@Length ž inputDD;
Grid@ð, Frame ® All, Alignment ® LeftD & ž Transpose@8input, Table@" + ", 8Length@inputD<D<DD
é Example: display in a grid CumulantProductVectorToCumulantVectors of 881, 2, 3<, 84<<
In[136]:=
GridCumulantProductVectorToCumulantVectors @X, 881, 2, 3<, 84<<D
Number of terms in summation = 10
Out[136]=
Χ@X2 D Χ@X3 D Χ@X1 , X4 D
Χ@X1 , X4 D Χ@X2 , X3 D
Χ@X1 D Χ@X3 D Χ@X2 , X4 D
Χ@X1 , X3 D Χ@X2 , X4 D
Χ@X1 D Χ@X2 D Χ@X3 , X4 D
Χ@X1 , X2 D Χ@X3 , X4 D
Χ@X3 D Χ@X1 , X2 , X4 D
Χ@X2 D Χ@X1 , X3 , X4 D
Χ@X1 D Χ@X2 , X3 , X4 D
Χ@X1 , X2 , X3 , X4 D
+
+
+
+
+
+
+
+
+
+
The input is Χ@X1 X2 X3 , X4 D.
é Example: compare these results with the JoinSolve of 881, 2, 3<, 84<<
In[137]:=
Grid@ð, Frame ® 8None, All<D & ž HReverse ž JoinSolve@881, 2, 3<, 84<<DL
Number of Solutions to Join Problem = 10
Out[137]=
81, 4<
82<
83<
81<
82, 4<
83<
81<
82<
83, 4<
81, 3<
82, 4<
81, 2, 4<
83<
81, 4<
82, 3<
81, 3, 4<
82<
81, 2<
83, 4<
81<
82, 3, 4<
81, 2, 3, 4<
ì CumulantProductVectorToMoments: express the joint
cumulant of a random vector IX b1 , X b2 , ..., X bk M, where
8b1, b2, ..., bk < Í @nD, in terms of moments
In[138]:=
NewJoinSolve @P_D ; If@SetPartitionQ @PD, True, Message@NewJoinSolve ::badarg, PD; FalseD :=
Module@8A, B<, A = Table@PartitionUnion @SetPartitions @Length@Flatten@PDDD@@iDD, PD,
8i, 1, Length@SetPartitions @Length@Flatten@PDDDD<D;
B = Table@If@Length@A@@iDDD Š 1, True, FalseD, 8i, 1, Length@AD<D;
K = Pick@SetPartitions @Length@Flatten@PDDD, BDD
In[139]:=
CumulantProductVectorToMoments @X_, A_D ;
If@SetPartitionQ @AD, True, Message@CumulantProductVectorToMoments ::badarg, AD; FalseD :=
Block@8int = Length@Flatten@ADD, rules, setpartitions , E, myRules<,
rules = Table@i ® Flatten@AD@@iDD, 8i, 1, int<D;
myRules = Block@8field = Map@List, Drop@Subsets@Flatten@ADD, 1DD<,
Table@Rule@E@X, field@@iDDD, E@Times@Sequence žž HSubscript@X, ðD & ž field@@i, 1DDLDDD,
8i, 1, Length ž field<DD; setpartitions = NewJoinSolve @AD . rules;
Total ž Table@Product@CumulantVectorToMoments @X, 8setpartitions @@i, jDD<D, 8j, 1, Length@
setpartitions @@iDDD<D, 8i, 1, Length ž setpartitions <D . myRulesD  FullSimplify
é Example: express the cumulants Χ@X1 X2 , X3 D in terms of moments
In[140]:=
Out[140]=
CumulantProductVectorToMoments @X, 881, 2<, 83<<D
- E@X1 X2 D E@X3 D + E@X1 X2 X3 D
The input is Χ@X1 X2 , X3 D.
é Example: express the cumulants Χ@X1 , X2 , X3 D in terms of moments
In[141]:=
Out[141]=
CumulantProductVectorToMoments @X, 881<, 82<, 83<<D  Expand
2 E@X1 D E@X2 D E@X3 D - E@X1 X2 D E@X3 D - E@X2 D E@X1 X3 D - E@X1 D E@X2 X3 D + E@X1 X2 X3 D
The input is Χ@X1 , X2 , X3 D since here 881<, 82<, 83<< signifies the vector HX1 , X2 , X3 L.
é Example: express the cumulants Χ@X1 X2 X3 D in terms of moments
In[142]:=
Out[142]=
CumulantProductVectorToMoments @X, 881, 2, 3<<D
E@X1 X2 X3 D
Thus, Χ@X1 X2 X3 D = E@X1 X2 X3 D. In fact, for any random variable Y , one has Χ@Y D = E@Y D.
As noted above, the result for CumulantProductVectorToMoments[X,{{1},{2},{3}}] can also be obtained by:
In[143]:=
Out[143]=
CumulantVectorToMoments @X, 881, 2, 3<<D  Expand
2 E@X1 D E@X2 D E@X3 D - E@X1 X2 D E@X3 D - E@X2 D E@X1 X3 D - E@X1 D E@X2 X3 D + E@X1 X2 X3 D
é Example: express the cumulant of ΧHX1 X2 X3 , X4 L in terms of moments
In[144]:=
Out[144]=
CumulantProductVectorToMoments @X, 881, 2, 3<, 84<<D
- E@X1 X2 X3 D E@X4 D + E@X1 X2 X3 X4 D
Gaussian Multiple Integrals
ì GaussianIntegral: This function can be used to compute
multiple Gaussian integrals
ÙΣ f Hx1 , ..., xn L GHâ x1 L ... GHâ xn L
over a set partition Σ and
Ù³Σ f Hx1 , ..., xn L GHâ x1 L ... GHâ xn L
over all partitions at least as coarse as Σ, where f Hx1 , ..., xn L is a symmetric function, for
example, gHx1 L ... gHxn L, and where G is a Gaussian measure with control measure Ν. This
function generates the set partition data necessary to compute multiple Gaussian integrals.
In[145]:=
GaussianIntegral @P_D ;
If@SetPartitionQ @PD, True, Message@GaussianIntegral ::badarg, PD; FalseD :=
If@Max@Length ž PD ³ 3, "The integral is zero.",
Module@8sizeone = Select@P, Length@ðD Š 1 &D, sizetwo = Select@P, Length@ðD Š 2 &D<,
Grid@88Column@8"control measure Ν", Sequence žž sizetwo<, Frame ® AllD,
Column@8"Gaussian measure G", Sequence žž sizeone<, Frame ® AllD<<, Alignment ® TopDDD
é Example: when computing the multiple Gaussian integral over a set partition with a block size greater than or equal to three, the
integral is zero
In[146]:=
Out[146]=
GaussianIntegral @881, 2, 3<, 84, 5<, 86, 7<, 88<<D
The integral is zero.
é Example: compute the block data necessary to compute the multiple Gaussian integral over a particular set partition
In[147]:=
Out[147]=
GaussianIntegral @881, 3<, 84, 5<, 86<, 87<, 82<<D
control measure Ν
81, 3<
84, 5<
Gaussian measure G
86<
87<
82<
Interpretation: Let Σ = 881, 3<, 84, 5<, 86<, 87<, 82<<. Integrating gHx1 L ... gHx7 L over Σ gives
IÙ g2 HxL ΝHâ xLM Ùx ¹x ¹x gHx2 L gHx6 L gHx7 L GHâ x2 L GHâ x6 L GHâ x7 L.
2
6
7
2
If one integrates it over "³Σ" instead, one obtains
IÙ g2 HxL ΝHâ xLM IÙ gHxL GHâ xLM .
2
3
Rule 1: To obtain a Gaussian multiple integral over Σ, equate the variables listed under "control measure Ν" and integrate them
with respect to Ν; the variables listed under "Gaussian measure G" are integrated with respect to G over the off-diagonals.
Rule 2: To obtain a Gaussian multiple integral over "³Σ", equate the variables listed under "control measure Ν" and integrate
them with respect to Ν; the variables listed under "Gaussian measure G" are integrated with respect to G.
Rule 2: To obtain a Gaussian multiple integral over "³Σ", equate the variables listed under "control measure Ν" and integrate
them with respect to Ν; the variables listed under "Gaussian measure G" are integrated with respect to G.
é Examples worked out in the text (assume f is a symmetric function):
In[148]:=
GaussianIntegral @881<, 82<, 83<<D
control measure Ν
Out[148]=
Gaussian measure G
81<
82<
83<
Integrating f over the singleton partition Σ = 881<, 82<, 83<< gives the identity. The input and output both correspond to
Ùx1 ¹x2 ¹x3 f Hx1 , x2 , x3 L GHâ x1 L GHâ x2 L GHâ x3 L.
Integrating f over "³Σ", in this case, over the whole space, gives
Ù f Hx1 , x2 , x3 L GHâ x1 L GHâ x2 L GHâ x3 L.
In[149]:=
Out[149]=
GaussianIntegral @881, 2, 3<, 84<<D
The integral is zero.
This integral is zero because Σ = 881, 2, 3<, 84<< has block of size greater than two.
In[150]:=
Out[150]=
GaussianIntegral @881, 2<<D
control measure Ν
81, 2<
Gaussian measure G
Integrating f over the maximal partition Σ = 881, 2<< gives
Ùx1 =x2 f Hx1 , x2 L GHâ x1 L GHâ x2 L = Ù f Hx, xL ΝHâ xL.
Integrating f over "³Σ" gives the same thing in this case, since Σ is the maximal partition.
Ù³Σ f Hx1 , x2 L GHâ x1 L GHâ x2 L º Ùx1 =x2 f Hx1 , x2 L GHâ x1 L GHâ x2 L = Ù f Hx, xL ΝHâ xL.
In[151]:=
GaussianIntegral @881<<D
control measure Ν
Out[151]=
In[152]:=
Out[152]=
Gaussian measure G
81<
GaussianIntegral @881<, 82, 3<<D
control measure Ν
82, 3<
Ù f Hx1 L GHâ x1 L = Ù f Hx1 L GHâ x1 L.
Gaussian measure G
81<
Integrating f over Σ = 881<, 82, 3<< gives
Ùx1 ¹x2 =x3 f Hx1 , x2 , x3 L GHâ x1 L GHâ x2 L GHâ x3 L = Ù f Hx, y, yL GHâ xL ΝHâ yL.
Integrating f over ³ Σ gives
Ù³Σ f Hx1 , x2 , x3 L GHâ x1 L GHâ x2 L GHâ x3 L = Ù f Hx, y, yL GHâ xL ΝHâ yL.
Ù³Σ f Hx1 , x2 , x3 L GHâ x1 L GHâ x2 L GHâ x3 L = Ù f Hx, y, yL GHâ xL ΝHâ yL.
To see that this makes sense, let's list all partitions of "³Σ":
In[153]:=
Out[153]=
CoarserThan@881<, 82, 3<<D
8881, 2, 3<<, 881<, 82, 3<<<
The integral associated with 881, 2, 3<< is equal to zero, and the integral associated with 881<, 82, 3<< is Ù f Hx, y, yL GHâ xL ΝHâ yL.
In[154]:=
Out[154]=
GaussianIntegral @881, 2<, 83<, 84<, 85, 6<<D
control measure Ν
81, 2<
85, 6<
Gaussian measure G
83<
84<
Integrating f over the partition Σ = 881, 2<, 83<, 84<, 85, 6<< gives
Ùx1 =x2 ¹x3 ¹x4 ¹x5 =x6 f Hx1 , x2 , x3 , x4 , x5 , x6 L GHâ x1 L ... GHâ x6 L
= Ùx¹y f Hw, w, x, y, z, zL ΝHâ wL GHâ xL GHâ yL ΝHâ zL.
Integrating f over ³ Σ gives
Ù³Σ f Hx1 , x2 , x3 , x4 , x5 , x6 L GHâ x1 L ... GHâ x6 L
= Ù f Hw, w, x, y, z, zL ΝHâ wL GHâ xL GHâ yL ΝHâ zL.
In[155]:=
GaussianIntegral @881, 2<, 83<, 84<, 85<, 86<<D
control measure Ν
81, 2<
Out[155]=
Gaussian measure G
83<
84<
85<
86<
Integrating f over the partition Σ = 881, 2<, 83<, 84<, 85<, 86<< gives
Ùx1 =x2 ¹...¹x6 f Hx1 , x2 , x3 , x4 , x5 , x6 L GHâ x1 L ... GHâ x6 L
= Ùx ¹...¹x f Hx2 , x2 , x3 , x4 , x5 , x6 L ΝHâ x2 L GHâ x3 L ... GHâ x6 L.
3
6
Integrating f over ³ Σ gives
Ù³Σ f Hx1 , x2 , x3 , x4 , x5 , x6 L GHâ x1 L ... GHâ x6 L
= Ù f Hx2 , x2 , x3 , x4 , x5 , x6 L ΝHâ x2 L GHâ x3 L ... GHâ x6 L.
In[156]:=
Out[156]=
GaussianIntegral @881, 3<, 84, 5<, 86<, 87<, 82<<D
control measure Ν
81, 3<
84, 5<
Gaussian measure G
86<
87<
82<
With Σ = 881, 3<, 84, 5<, 86<, 87<, 82<<, integrating f over Σ gives
ÙΣ f Hx1 , x2 , x3 , x4 , x5 , x6 , x7 L GHâ x1 L ... GHâ x7 L
ÙΣ f Hx1 , x2 , x3 , x4 , x5 , x6 , x7 L GHâ x1 L ... GHâ x7 L
= Ùx ¹x ¹x f Hx3 , x2 , x3 , x5 , x5 , x6 , x7 L ΝHâ x3 L GHâ x2 L ΝHâ x5 L GHâ x6 L GHâ x7 L.
2
6
7
Integrating f over ³ Σ gives
Ù³Σ f Hx1 , x2 , x3 , x4 , x5 , x6 , x7 L GHâ x1 L ... GHâ x7 L
= Ù f Hx2 , x2 , x3 , x5 , x5 , x6 , x7 L ΝHâ x2 L GHâ x3 L ΝHâ x5 L GHâ x6 L GHâ x7 L.
Poisson Multiple Integrals
We first define some functions which are useful for the evaluation of Poisson multiple
integrals.
ì BOne: for a given set partition Σ, find B1HΣL, that is, isolate the
blocks of Σ that are singletons
In[157]:=
BOne@P_D ; If@SetPartitionQ @PD, True, Message@BOne::badarg, PD; FalseD :=
Select@P, Length@ðD Š 1 &D
é Example: find all of the singleton blocks of 881, 2<, 83, 4<, 85<<
In[158]:=
Out[158]=
BOne@881, 2<, 83, 4<, 85<<D
885<<
é Example: the set partition 881, 2, 3<, 84, 5<< has no singleton blocks
In[159]:=
Out[159]=
BOne@881, 2, 3<, 84, 5<<D
8<
ì BTwo: for a given set partition Σ, find B2HΣL, that is, isolate the
blocks of Σ that are not singletons
In[160]:=
BTwo@P_D ; If@SetPartitionQ @PD, True, Message@BTwo::badarg, PD; FalseD :=
Select@P, Length@ðD ³ 2 &D
é Example: find all of the blocks of 881, 2<, 83, 4<, 85<< that are not singletons
In[161]:=
Out[161]=
BTwo@881, 2<, 83, 4<, 85<<D
881, 2<, 83, 4<<
é Example: the set partition 881<, 82<, 83<, 84<, 85<< has no blocks that are not singletons
In[162]:=
Out[162]=
BTwo@881<, 82<, 83<, 84<, 85<<D
8<
ì PBTwo: for a fixed set partition Σ, find B2HΣL; regarding B2HΣL
as a set, find all ordered partitions of B2HΣL with exactly two
blocks, called R1 and R2
In[163]:=
PBTwo@P_D ; If@SetPartitionQ @PD, True, Message@PBTwo::badarg, PD; FalseD :=
Module@8input = BTwo@PD, size, candidates, rules, group, display<,
size = Length@inputD; rules = Rule@ð@@1DD, ð@@2DDD & ž Transpose@8Range@sizeD, input<D;
candidates = Select@SetPartitions @sizeD, Length@ðD Š 2 &D;
group = Union@candidates, Reverse ž candidatesD . rules; Grid@Transpose ž
8Join@8"R1"<, Map@ð@@1DD &, groupDD, Join@8"R2"<, Map@ð@@2DD &, groupDD<, Frame ® AllDD
é Example: for the set partition 881, 2<, 83, 4<, 85, 6<, 87<<, find PB2 H881, 2<, 83, 4<, 85, 6<, 87<<L
In[164]:=
Out[164]=
PBTwo@881, 2<, 83, 4<, 85, 6<, 87<<D
R1
R2
881, 2<<
883, 4<, 85, 6<<
883, 4<<
881, 2<, 85, 6<<
885, 6<<
881, 2<, 83, 4<<
881, 2<, 83, 4<<
885, 6<<
881, 2<, 85, 6<<
883, 4<<
883, 4<, 85, 6<<
881, 2<<
é Example: for the set partition 881, 2, 3<, 84, 5, 6<, 87<, 88<, 89, 10<<, find PB2 H881, 2, 3<, 84, 5, 6<, 87<, 88<, 89, 10<<L
In[165]:=
Out[165]=
PBTwo@881, 2, 3<, 84, 5, 6<, 87<, 88<, 89, 10<<D
R1
R2
881, 2, 3<<
884, 5, 6<, 89, 10<<
884, 5, 6<<
881, 2, 3<, 89, 10<<
889, 10<<
881, 2, 3<, 84, 5, 6<<
881, 2, 3<, 84, 5, 6<<
889, 10<<
881, 2, 3<, 89, 10<<
884, 5, 6<<
884, 5, 6<, 89, 10<<
881, 2, 3<<
é Example: for the set partition 881, 2<, 83<<, PB2 H881, 2<, 83<<L is empty
In[166]:=
Out[166]=
PBTwo@881, 2<, 83<<D
R1 R2
ì PoissonIntegral: This function can be used to compute
multiple Poisson integrals
PoissonIntegral: This function can be used to compute
multiple Poisson integrals
`
`
ÙΣ f Hx1 , ..., xn L NHâ x1 L ... NHâ xn L
over a set partition Σ, where f Hx1 , ..., xn L is a symmetric function, for example, gHx1 L ... gHxn L,
`
and where N is a compensated Poisson measure with control measure Ν. This function generates the set partition data necessary to compute multiple Poisson integrals.
In[167]:=
PoissonIntegral @P_D ;
If@SetPartitionQ @PD, True, Message@PoissonIntegral ::badarg, PD; FalseD :=
If@Max@Length ž PD Š 1, Column@8Row@8Grid@Transpose ž 88"R1"<, 8"R2"<<, Frame ® AllD,
Grid@Transpose@88"B1"<<D, Frame ® AllD<D, Spacer@5D,
Row@8Grid@88"B2"<, 8BTwo@PD<<, Frame ® All, Alignment ® CenterD,
Grid@88"B1"<, 8BOne@PD<<, Frame ® All, Alignment ® CenterD<D<D,
Module@8inputone = BTwo@PD, inputtwo = BOne@PD, size, candidates, rules, group, display<,
size = Length@inputoneD;
rules = Rule@ð@@1DD, ð@@2DDD & ž Transpose@8Range@sizeD, inputone<D;
candidates = Select@SetPartitions @sizeD, Length@ðD Š 2 &D;
group = Union@candidates, Reverse ž candidatesD . rules;
Column@8Row@8Grid@Transpose ž 8Join@8"R1"<, Map@ð@@1DD &, groupDD,
Join@8"R2"<, Map@ð@@2DD &, groupDD<, Frame ® AllD,
Grid@Transpose@8Join@8"B1"<, Table@inputtwo, 8Length ž group<DD<D, Frame ® AllD<D,
Spacer@3D, Row@8Grid@Transpose ž 8Join@8"B2"<, 8inputone<D<, Frame ® AllD,
Grid@Transpose ž 8Join@8"B1"<, 8inputtwo<D<, Frame ® AllD<D<DDD
é Example: for the set partition Σ = 881, 2, 3<, 84, 5<, 86<, 87<<, compute R1 , R2 , B1 and B2 , which are involved in the computation of
the multiple Poisson integral over Σ
In[168]:=
PoissonIntegral @881, 2, 3<, 84, 5<, 86<, 87<<D
R1
R2
881, 2, 3<<
884, 5<<
884, 5<<
881, 2, 3<<
B1
886<, 87<<
886<, 87<<
Out[168]=
B2
881, 2, 3<, 84, 5<<
B1
886<, 87<<
`
`
Interpretation: Let Σ = 881, 2, 3<, 84, 5<, 86<, 87<<. Integrating gHx1 L ... gHx7 L over Σ with respect to the product N Hâ x1 L ... N Hâ x7 L
of compensated Poisson measures gives:
`
`
ÙΣ gHx1 L ... gHx7 L N Hâ x1 L ... N Hâ x7 L
`
`
`
= Ù g3 Hx3 L ΝHâ x3 L Ùx ¹x ¹x g2 Hx5 L gHx6 L gHx7 L N Hâ x5 L N Hâ x6 L N Hâ x7 L
5
6
7
`
`
`
+Ù g2 Hx5 L ΝHâ x5 L Ùx ¹x ¹x g3 Hx3 L gHx6 L gHx7 L N Hâ x3 L N Hâ x6 L N Hâ x7 L
3
ì
6
7
`
`
`
`
+Ùx ¹x ¹x ¹x g3 Hx3 L g2 Hx5 L gHx6 L gHx7 L N Hâ x3 L N Hâ x5 L N Hâ x6 L N Hâ x7 L
3
5
6
7
`
`
+Ù g3 Hx3 L ΝHâ x3 L Ù g2 Hx5 L ΝHâ x5 L Ùx ¹x gHx6 L gHx7 L N Hâ x6 L N Hâ x7 L
6
7
`
`
+Ù g3 Hx3 L ΝHâ x3 L Ù g2 Hx5 L ΝHâ x5 L Ùx ¹x gHx6 L gHx7 L N Hâ x6 L N Hâ x7 L
6
7
To get the first term, one uses HR1, R2, B1L from the first line of the first group of outputs, to get the second term, one uses
HR1, R2, B1L from the second line of the first group of outputs, and to get the last two terms, one uses HB2, B1L from the second
group of outputs.
`
Rule: The integral of a symmetric function over Σ with respect to a product of compensated Poisson measures N is a sum of
K + 2 terms, where K is the number of rows in the display (R1, R2, B1). They are obtained as follows:
(1) The variables with indices in R1 are identified and integrated over Ν; the variables with indices in a block of R2 are identified.
`
These identified variables, together with the variables with indices in B1, are integrated over N on the off-diagonals. This is done
for each row of the display (R1, R2, B1).
There are two other terms:
(2) The variables with indices in blocks of B2 are identified. These identified variables, together with the variables in B1, are
`
integrated over N on the off-diagonals.
(3) The variables with indices in each block of B2 are identified and integrated over Ν; the variables with indices in B1 are
`
integrated over N on the off-diagonals.
é Other examples:
In[169]:=
PoissonIntegral @881, 2<, 83, 4<, 85<, 86<<D
R1
R2
881, 2<< 883, 4<<
883, 4<< 881, 2<<
B1
885<, 86<<
885<, 86<<
Out[169]=
B2
881, 2<, 83, 4<<
B1
885<, 86<<
The integral
`
`
ÙΣ gHx1 L ... gHx6 L N Hâ x1 L ... N Hâ x6 L
`
`
`
= 2 IÙ g2 Hx2 L ΝHâ x2 LM Ùx ¹x ¹x g2 Hx4 L gHx5 L gHx6 L N Hâ x4 L N Hâ x5 L N Hâ x6 L
4
5
6
`
`
`
`
+Ùx ¹x ¹x ¹x g2 Hx2 L g2 Hx4 L gHx5 L gHx6 L N Hâ x2 L N Hâ x4 L N Hâ x5 L N Hâ x6 L
2
4
5
6
`
`
2
+IÙ g2 Hx2 L ΝHâ x2 LM Ùx ¹x gHx5 L gHx6 L N Hâ x5 L N Hâ x6 L
5
6
To get the first term, one uses HR1, R2, B1L from the first group of outputs and to get the last two terms one uses HB2, B1L from
the second group of outputs.
In[170]:=
Out[170]=
PoissonIntegral @881, 2, 3<, 84, 5, 6<, 87<, 88<, 89, 10<<D
R1
R2
881, 2, 3<<
884, 5, 6<, 89, 10<<
884, 5, 6<<
881, 2, 3<, 89, 10<<
889, 10<<
881, 2, 3<, 84, 5, 6<<
881, 2, 3<, 84, 5, 6<<
889, 10<<
881, 2, 3<, 89, 10<<
884, 5, 6<<
884, 5, 6<, 89, 10<<
881, 2, 3<<
B2
881, 2, 3<, 84, 5, 6<, 89, 10<<
B1
887<, 88<<
887<, 88<<
887<, 88<<
887<, 88<<
887<, 88<<
887<, 88<<
B1
887<, 88<<
é Examples worked out in the text:
In[171]:=
PoissonIntegral @881<, 82<, 83<<D
R1 R2
Out[171]=
B2
8<
B1
B1
881<, 82<, 83<<
In this case, the left- and right-hand sides are identical:
`
`
`
`
ÙΣ gHx1 L ... gHx3 L N Hâ x1 L ... N Hâ x3 L = Ùx1 ¹x2 ¹x3 gHx1 L ... gHx3 L N Hâ x1 L ... N Hâ x3 L.
In[172]:=
PoissonIntegral @881, 2, 3<<D
R1 R2
Out[172]=
B1
B2
881, 2, 3<<
B1
8<
The integral is
`
`
`
ÙΣ gHx1 L ... gHx3 L N Hâ x1 L ... N Hâ x3 L = Ù g3 Hx3 L N Hâ x3 L + Ù g3 Hx3 L ΝHâ x3 L,
which simplifies to
In[173]:=
PoissonIntegral @881<, 82, 3<<D
R1 R2
Out[173]=
B2
882, 3<<
Ù g3 Hx3 L NHâ x3 L.
B1
B1
881<<
The integral is
`
`
ÙΣ gHx1 L ... gHx3 L N Hâ x1 L ... N Hâ x3 L
`
`
`
= Ùx ¹x g2 Hx3 L gHx1 L N Hâ x3 L N Hâ x1 L + Ù g2 Hx3 L ΝHâ x3 L Ù gHx1 L N Hâ x1 L.
3
1
In[174]:=
PoissonIntegral @881, 2<, 83<, 84<, 85, 6<<D
R1
R2
881, 2<< 885, 6<<
885, 6<< 881, 2<<
B1
883<, 84<<
883<, 84<<
Out[174]=
B2
881, 2<, 85, 6<<
B1
883<, 84<<
The integral is
`
`
ÙΣ gHx1 L ... gHx6 L N Hâ x1 L ... N Hâ x6 L
`
`
`
2 Ù g2 Hx2 L Ν Hâ x2 L Ùx ¹x ¹x g2 Hx6 L gHx3 L g Hx4 L N Hâ x6 L N Hâ x3 L N Hâ x4 L.
6
3
4
`
`
`
`
+Ùx ¹x ¹x ¹x g2 Hx6 L g2 Hx2 L gHx3 L gHx4 L N Hâ x6 L N Hâ x2 L N Hâ x3 L N Hâ x4 L
6
2
3
4
`
`
2
+IÙ g2 Hx2 L ΝHâ x2 LM Ùx ¹x gHx3 L gHx4 L N Hâ x3 L N Hâ x4 L.
3
4
In[175]:=
PoissonIntegral @881, 2<, 83<, 84<, 85<, 86<<D
R1 R2
Out[175]=
B2
881, 2<<
B1
B1
883<, 84<, 85<, 86<<
The integral is
`
`
ÙΣ gHx1 L ... gHx6 L N Hâ x1 L ... N Hâ x6 L
`
`
= Ùx ¹...¹x g2 Hx2 L gHx3 L gHx4 L gHx5 L gHx6 L N Hâ x2 L ... N Hâ x6 L
2
6
`
`
+Ù g2 Hx2 L ΝHâ x2 L Ùx ¹x ¹x ¹x gHx3 L gHx4 L gHx5 L gHx6 L N Hâ x2 L ... N Hâ x6 L.
3
4
5
6
ì PoissonIntegralExceed: This function can be used to compute
multiple Poisson integrals
`
`
Ù³Σ f Hx1 , ..., xn L NHâ x1 L ... NHâ xn L,
`
where f Hx1 , ..., xn L is a symmetric function, for example, gHx1 L ... gHxn L, and where N is a compensated Poisson measure with control measure Ν. This function generates the set partition
data necessary to compute multiple Poisson integrals over set partitions greater than or
equal to Σ.
In[176]:=
PoissonIntegralExceed @P_D ;
If@SetPartitionQ @PD, True, Message@PoissonIntegralExceed ::badarg, PD; FalseD :=
If@Max@Length ž PD Š 1, Grid@88"B1"<, 8BOne@PD<<, Frame ® All, Alignment ® CenterD,
Module@8inputone = BTwo@PD, inputtwo = BOne@PD, size, candidates, rules, group, display<,
size = Length@inputoneD;
rules = Rule@ð@@1DD, ð@@2DDD & ž Transpose@8Range@sizeD, inputone<D;
candidates = Select@SetPartitions @sizeD, Length@ðD Š 2 &D;
group = Union@candidates, Reverse ž candidatesD . rules;
Row@8Grid@Transpose ž 8Join@8"B2"<, 8inputone<D<, Frame ® AllD,
Grid@Transpose ž 8Join@8"B1"<, 8inputtwo<D<, Frame ® AllD<DDD
é Example: compute a Poisson integral over ³ Σ where Σ = 881, 2, 3<, 84, 5<, 86<, 87<<
In[177]:=
Out[177]=
PoissonIntegralExceed @881, 2, 3<, 84, 5<, 86<, 87<<D
B2
881, 2, 3<, 84, 5<<
B1
886<, 87<<
Interpretation: Let Σ = 881, 2, 3<, 84, 5<, 86<, 87<<. Integrating gHx1 L ... gHx7 L over all those set partitions greater than or equal to Σ
`
`
with respect to the product N Hâ x1 L ... N Hâ x7 L of compensated Poisson measures gives:
`
2
3
2
à g Hx3 L NHâ x3 L à g Hx5 L NHâ x5 L JÙ gHx7 L N Hâ x7 LN
Rule: Equate the variables in each block of B2 and integrate them with respect to the uncompensated Poisson measure N; the
`
variables listed in B1 are integrated wiht respect to the compensated Poisson measure N .
é Example: compute a Poisson integral over ³ Σ where Σ = 881<, 82<, 83<<, the singleton partition of order 3
In[178]:=
Out[178]=
PoissonIntegralExceed @881<, 82<, 83<<D
B1
881<, 82<, 83<<
The integral is
`
`
`
`
Ù³Σ gHx1 L ... gHx3 L N Hâ x1 L ... N Hâ x3 L = Ù gHx1 L ... gHx3 L N Hâ x1 L ... N Hâ x3 L
because Σ is a singleton and, therefore, integrating over "³Σ" is equivalent to integrating over the whole space.
é Example: compute a Poisson integral over ³ Σ where Σ = 881, 2, 3<<, the maximal partition of order 3
In[179]:=
Out[179]=
PoissonIntegralExceed @881, 2, 3<<D
B2
881, 2, 3<<
B1
8<
Thus,
`
`
`
Ù³1` gHx1 L gHx2 L gHx3 L N Hâ x1 L N Hâ x2 L N Hâ x3 L = Ù gHxL3 NHâ xL.
`
Observe that integrating over "³1", namely, the collection of set partitions that is greater than or equal to the maximal set parti`
tion is the same as integrating over the maximal partition 1.
é Example: compute a Poisson integral over ³ Σ where Σ = 881, 2, 3<, 84, 5, 6<, 87<, 88<, 89, 10<<
Example: compute a Poisson integral over ³ Σ where Σ = 881, 2, 3<, 84, 5, 6<, 87<, 88<, 89, 10<<
In[180]:=
Out[180]=
PoissonIntegralExceed @881, 2, 3<, 84, 5, 6<, 87<, 88<, 89, 10<<D
B2
881, 2, 3<, 84, 5, 6<, 89, 10<<
B1
887<, 88<<
Thus,
`
`
`
2
Ù³Σ gHx1 L ... gHx10 L N Hâ x1 L ... N Hâ x10 L = IÙ g8 Hx1 L NHâ x1 LM JÙ gHx2 L N Hâ x2 LN .
If f is symmetric, then
`
`
`
`
Ù³Σ f Hx1 , ..., x10 L N Hâ x1 L ... N Hâ x10 L = Ù f Hx, ..., x, y, zL NHâ xL N Hâ yL N Hâ zL.
Contraction and Symmetrization
ì ContractionWithSymmetrization: in the product of two
symmetric functions of p and q variables, respectively, identify
r variables in each function and symmetrize the result
In[181]:=
é
ContractionWithSymmetrization @p_, q_, r_D ; If@HTrueQ@r £ Min@p, qDDL,
True, Message@ContractionWithSymmetrization ::badarg, rD; FalseD :=
Block@8initialspan = Range@p + qD, splitfirst = Range@pD, splitsecond = Range@qD + p,
workinglist, identificationrules , transformedlist , condensedlist , purgedlist,
secondpurgedlist , finallist<, workinglist = Block@8initdata = KSubsets@initialspan, pD<,
8ð, Complement@initialspan, ðD< & ž initdataD; identificationrules =
Join@If@r Š 0, 8<, Table@splitsecond @@iDD ® splitfirst@@iDD, 8i, 1, r<DD,
If@HHr Š 0L ÈÈ r > Length@splitsecond D - 1L, 8<,
Table@splitsecond @@i + 1DD ® splitsecond @@iDD, 8i, r, Length@splitsecond D - 1<DDD;
transformedlist = workinglist . identificationrules ;
purgedlist = Union@Select@transformedlist , HLength@Union@ð@@1DDDD Š Length ž splitfirstL &&
HLength@Union@ð@@2DDDD Š Length ž splitsecond L ⅅ secondpurgedlist =
Union@Table@Table@Sort ž purgedlist@@i, jDD, 8j, 1, 2<D, 8i, 1, Length ž purgedlist<DD;
finallist = Select@secondpurgedlist , HHLength@ð@@1DDD Š pL && HLength@ð@@2DDD Š qLL &D;
Print ž H"Number of terms after symmetrization = " <> ToString@Binomial@p + q - 2 r, p - rDDL;
Column@Union@Table@Sequence žž 8finallist@@iDD<, 8i, 1, Length ž finallist<DD, Frame ® AllDD
ì
Input format: ContractionWithSymmetrization[p,q,r], where r £ min 8p, q<
é Example: compute the contraction with symmetrization of a pair of two-dimensional symmetric functions f and g, identifying one
of the variables
In[182]:=
ContractionWithSymmetrization @2, 2, 1D
Number of terms after symmetrization = 2
Out[182]=
881, 2<, 81, 3<<
881, 3<, 81, 2<<
The input function is f Hx1 , x2 L gHx3 , x4 L. The output is
1
2
H f Hx1 , x2 L gHx1 , x3 L + f Hx1 , x3 L gHx1 , x2 LL.
é Example: compute the symmetrization of a pair of two-dimensional symmetric functions f and g, identifying none of the variables
In[183]:=
ContractionWithSymmetrization @2, 2, 0D
Number of terms after symmetrization = 6
Out[183]=
881,
881,
881,
882,
882,
883,
2<,
3<,
4<,
3<,
4<,
4<,
83,
82,
82,
81,
81,
81,
4<<
4<<
3<<
4<<
3<<
2<<
é Example: compute the contraction with symmetrization of a pair of two-dimensional symmetric functions f and g, identifying all
of the variables
In[184]:=
ContractionWithSymmetrization @2, 2, 2D
Number of terms after symmetrization = 1
Out[184]=
881, 2<, 81, 2<<
The input function is f Hx1 , x2 L gHx3 , x4 L. Two variables are equated in each of the arguments. The output function is
f Hx1 , x2 L gHx1 , x2 L.
é Example: compute the contraction with symmetrization of a pair of two-dimensional symmetric function f and a threedimensional symmetric function g, identifying one of the variables
In[185]:=
ContractionWithSymmetrization @2, 3, 1D
Number of terms after symmetrization = 3
Out[185]=
881, 2<, 81, 3, 4<<
881, 3<, 81, 2, 4<<
881, 4<, 81, 2, 3<<
The input function is f Hx1 , x2 L gHx3 , x4 , x5 L. One variable is equated in each of the arguments. The output function is
1
6
H f Hx1 , x2 L gHx1 , x3 , x4 L + f Hx1 , x3 L gHx1 , x2 , x4 L + f Hx1 , x4 L gHx1 , x2 , x3 LL.
1
6
H f Hx1 , x2 L gHx1 , x3 , x4 L + f Hx1 , x3 L gHx1 , x2 , x4 L + f Hx1 , x4 L gHx1 , x2 , x3 LL.
é Example: attempt to compute the contraction with symmetrization when r > min 8 p, q<
In[186]:=
ContractionWithSymmetrization @2, 3, 4D
ContractionWithSymmetrization::badarg : r must be less than p and q. Invalid argument 4
Out[186]=
ContractionWithSymmetrization @2, 3, 4D
ì ContractionIntegration: in the product of two symmetric
functions of p and q variables, respectively, identify r variables
in each function, and integrate l of these r variables. The
Ž
integrated variables are designated by an overtilde, e.g. 1.
In[187]:=
ì
ContractionIntegration @p_, q_, r_, l_D ; Which@HTrueQ@l £ rD && TrueQ@r £ Min@p, qDDL,
True, HHTrueQ@l £ rD Š FalseL && HTrueQ@r £ Min@p, qDD Š TrueLL,
Message@ContractionIntegration ::badargforl, lD,
HHTrueQ@l £ rD Š TrueL && HTrueQ@r £ Min@p, qDD Š FalseLL,
Message@ContractionIntegration ::badargforr, rD; FalseD :=
Block@8firstlist = Range@pD, secondlist<,
secondlist = Union@Join@Table@firstlist@@iDD, 8i, 1, r<D, Table@i + p, 8i, 1, q - r<DDD;
integrationrules = Table@i ® OverTilde@iD, 8i, 1, l<D;
8firstlist, secondlist< . integrationrules D
Input format: ContractionIntegration[p,q,r,l], where l £ r £ min 8p, q<
é Example:
In[188]:=
Out[188]=
ContractionIntegration @3, 2, 1, 1D
Ž
Ž
991, 2, 3=, 91, 4==
The input function is f Hx1 , x2 , x3 L gHx4 , x5 L. One variable is equated in each of the arguments, and then an integral is taken with
respect to that variable. The output function is Ù f Hx1 , x2 , x3 L gHx1 , x4 L ΝHâ x1 L.
In[189]:=
Out[189]=
ContractionIntegration @2, 4, 1, 1D
Ž
Ž
991, 2=, 91, 3, 4, 5==
The input function is f Hx1 , x2 L gHx3 , x4 , x5 , x6 L. One variable is equated in each of the arguments, and then an integral is taken
with respect to that variable. The output function is Ù f Hx1 , x2 L gHx1 , x3 , x4 , x5 L ΝHâ x1 L.
In[190]:=
Out[190]=
ContractionIntegration @2, 4, 2, 1D
Ž
Ž
991, 2=, 91, 2, 3, 4==
The input function is f Hx1 , x2 L gHx3 , x4 , x5 , x6 L. Two variables are equated in each of the arguments, and then an integral is
respect to one of these two variables. The output function is Ù f Hx1 , x2 L gHx1 , x2 , x5 , x6 L ΝHâ x1 L.
In[191]:=
ContractionIntegration @2, 4, 2, 3D
ContractionIntegration::badargforl : l must be less than or equal to r. Invalid argument 3
Out[191]=
ContractionIntegration @2, 4, 2, 3D
We get an error message because 3 = l > r = 2.
In[192]:=
ContractionIntegration @2, 4, 5, 1D
ContractionIntegration::badargforr : r must be less than both p and q. Invalid argument 5
Out[192]=
ContractionIntegration @2, 4, 5, 1D
We get an error message because 5 = r > min 8 p, q< = 2.
In[193]:=
Out[193]=
In[194]:=
Out[194]=
In[195]:=
Out[195]=
In[196]:=
Out[196]=
In[197]:=
Out[197]=
In[198]:=
Out[198]=
In[199]:=
Out[199]=
ContractionIntegration @2, 2, 1, 0D
881, 2<, 81, 3<<
ContractionIntegration @2, 2, 1, 1D
Ž
Ž
991, 2=, 91, 3==
ContractionIntegration @2, 2, 2, 2D
Ž Ž
Ž Ž
991, 2=, 91, 2==
ContractionIntegration @3, 2, 2, 2D
Ž Ž
Ž Ž
991, 2, 3=, 91, 2==
ContractionIntegration @3, 2, 2, 1D
Ž
Ž
991, 2, 3=, 91, 2==
ContractionIntegration @4, 3, 2, 1D
Ž
Ž
991, 2, 3, 4=, 91, 2, 5==
ContractionIntegration @3, 4, 2, 1D
Ž
Ž
991, 2, 3=, 91, 2, 4, 5==
ì ContractionIntegrationWithSymmetrization: in the product of
two symmetric functions of p and q variables, respectively,
identify r variables in each function, integrate l of these r
variables, and then symmetrize the result
In[200]:=
ContractionIntegrationWithSymmetrization @p_, q_, r_, l_D ;
Which@HTrueQ@l £ rD && TrueQ@r £ Min@p, qDDL, True,
HHTrueQ@l £ rD Š FalseL && HTrueQ@r £ Min@p, qDD Š TrueLL,
Message@ContractionIntegrationWithSymmetrization ::badargforl, lD,
HTrueQ@r £ Min@p, qDD Š FalseL,
Message@ContractionIntegrationWithSymmetrization ::badargforr, rD; FalseD :=
If@r > Min@p, qD, "r must be less than both p and q",
Block@8initialspan = Range@p + qD, splitfirst = Range@pD, splitsecond = Range@qD + p,
workinglist, identificationrules , transformedlist , condensedlist ,
purgedlist, secondpurgedlist , finallist, integrationrules , integratedlist <,
workinglist = Block@8initdata = KSubsets@initialspan, pD<,
8ð, Complement@initialspan, ðD< & ž initdataD; identificationrules =
Join@If@r Š 0, 8<, Table@splitsecond @@iDD ® splitfirst@@iDD, 8i, 1, r<DD,
If@HHr Š 0L ÈÈ r > Length@splitsecond D - 1L, 8<,
Table@splitsecond @@i + 1DD ® splitsecond @@iDD, 8i, r, Length@splitsecond D - 1<DDD;
transformedlist = workinglist . identificationrules ;
purgedlist = Union@Select@transformedlist , HLength@Union@ð@@1DDDD Š Length ž splitfirstL &&
HLength@Union@ð@@2DDDD Š Length ž splitsecond L ⅅ secondpurgedlist =
Union@Table@Table@Sort ž purgedlist@@i, jDD, 8j, 1, 2<D, 8i, 1, Length ž purgedlist<DD;
finallist = Select@secondpurgedlist , HHLength@ð@@1DDD Š pL && HLength@ð@@2DDD Š qLL &D;
integrationrules = Table@i ® OverTilde@iD, 8i, 1, l<D;
integratedlist = finallist . integrationrules ;
Print ž H"Number of terms after symmetrization = " <> ToString@Binomial@p + q - 2 r, p - rDDL;
Column@Union@Table@Sequence žž 8integratedlist @@iDD<, 8i, 1, Length ž integratedlist <DD,
Frame ® AllDDD
é Examples:
In[201]:=
ContractionIntegrationWithSymmetrization @3, 2, 1, 1D
Number of terms after symmetrization = 3
Out[201]=
Ž
Ž
991, 2, 3=, 91, 4==
Ž
Ž
991, 2, 4=, 91, 3==
Ž
Ž
991, 3, 4=, 91, 2==
The input function is f Hx1 , x2 , x3 L gHx4 , x5 L. The output is
1
3
Ù 8 f Hx1 , x2 , x3 L gHx1 , x4 L + f Hx1 , x2 , x4 L gHx1 , x3 L + f Hx1 , x3 , x4 L gHx1 , x2 L< ΝHâ x1 L.
In[202]:=
ContractionIntegrationWithSymmetrization @2, 2, 1, 0D
Number of terms after symmetrization = 2
Out[202]=
In[203]:=
881, 2<, 81, 3<<
881, 3<, 81, 2<<
ContractionIntegrationWithSymmetrization @2, 2, 2, 1D
Number of terms after symmetrization = 1
Out[203]=
In[204]:=
Ž
Ž
991, 2=, 91, 2==
ContractionIntegrationWithSymmetrization @2, 2, 2, 2D
Number of terms after symmetrization = 1
Out[204]=
In[205]:=
Ž Ž
Ž Ž
991, 2=, 91, 2==
ContractionIntegrationWithSymmetrization @2, 2, 3, 4D
ContractionIntegrationWithSymmetrization::badargforr : r must be less than both p and q. Invalid argument 3
Out[205]=
ContractionIntegrationWithSymmetrization @2, 2, 3, 4D
We get an error message because 3 = r > min 8 p, q< = 2.
Solving Partition Equations Involving P*
ì PiStarMeetSolve: for a finite sequence of positive integers,
generate a unique set partition P* whose block sizes are equal
to these integers, and then find all set partitions Σ such that
`
the meet of Σ and P* is the singleton partition 0. The result is
used in Rota and Wallstrom's Theorem.
In[206]:=
PiStarMeetSolve @list_D ;
Which@HListQ@listD && TrueQ@Min@listD > 0D && Not@MemberQ@HIntegerQ ž listL, FalseDDL,
True, HListQ@listD Š False && TrueQ@Min@listD > 0D Š True &&
Not@MemberQ@HIntegerQ ž listL, FalseDD Š TrueL,
Message@PiStarMeetSolve ::notalist, listD, HListQ@listD Š True &&
TrueQ@Min@listD > 0D Š True && Not@MemberQ@HIntegerQ ž listL, FalseDD Š FalseL,
Message@PiStarMeetSolve ::notintegersinlist , listD, HListQ@listD Š True &&
TrueQ@Min@listD > 0D Š False && Not@MemberQ@HIntegerQ ž listL, FalseDD Š TrueL,
Message@PiStarMeetSolve ::integernotpositive , listD; FalseD :=
Module@8tot = Total@listD, ran, control = Transpose@
8Accumulate@Prepend@Drop@list, - 1D, 1DD, Accumulate@listD<D, pistar<, ran = Range@totD;
pistar = Table@ran@@control@@i, 1DD ;; control@@i, 2DDDD, 8i, 1, Length ž control<D;
Print@"pistar = " <> ToString@pistarDD; MeetSolve@pistarDD
é Input format: PiStarMeetSolve[list], where "list" is a list of positive integers that define the set partition P* . Each argument, for
example k, in the exist, defines a block of size k.
Input format: PiStarMeetSolve[list], where "list" is a list of positive integers that define the set partition P* . Each argument, for
example k, in the exist, defines a block of size k.
`
`
é Example: for the sequence 82, 2<, generate P* and find the meets of P* that give 0, that is, all partitions Σ such that Σ ß Π = 0
In[207]:=
PiStarMeetSolve @82, 2<D
pistar = 881, 2<, 83, 4<<
Number of Solutions to Meet Problem = 7
Out[207]=
8881, 4<, 82, 3<<, 881, 3<, 82, 4<<, 881<, 82, 3<, 84<<,
881<, 82, 4<, 83<<, 881, 3<, 82<, 84<<, 881, 4<, 82<, 83<<, 881<, 82<, 83<, 84<<<
`
é Example: for the sequence 81, 1, 2<, generate P* and find the meets of P* that give 0
In[208]:=
PiStarMeetSolve @81, 1, 2<D
pistar = 881<, 82<, 83, 4<<
Number of Solutions to Meet Problem = 10
Out[208]=
8881, 2, 3<, 84<<, 881, 4<, 82, 3<<, 881, 2, 4<, 83<<,
881, 3<, 82, 4<<, 881<, 82, 3<, 84<<, 881<, 82, 4<, 83<<, 881, 2<, 83<, 84<<,
881, 3<, 82<, 84<<, 881, 4<, 82<, 83<<, 881<, 82<, 83<, 84<<<
`
é Example: for the sequence 82, 2, 1<, generate P* and find the meets of P* that give 0
In[209]:=
PiStarMeetSolve @82, 2, 1<D
pistar = 881, 2<, 83, 4<, 85<<
Number of Solutions to Meet Problem = 27
Out[209]=
é
8881, 4, 5<, 82, 3<<, 881, 3<, 82, 4, 5<<, 881, 4<, 82, 3, 5<<, 881, 3, 5<, 82, 4<<,
881<, 82, 3<, 84, 5<<, 881<, 82, 4, 5<, 83<<, 881<, 82, 3, 5<, 84<<,
881<, 82, 4<, 83, 5<<, 881, 3<, 82<, 84, 5<<, 881, 4, 5<, 82<, 83<<,
881, 3, 5<, 82<, 84<<, 881, 4<, 82<, 83, 5<<, 881, 4<, 82, 3<, 85<<, 881, 5<, 82, 3<, 84<<,
881, 3<, 82, 4<, 85<<, 881, 5<, 82, 4<, 83<<, 881, 3<, 82, 5<, 84<<, 881, 4<, 82, 5<, 83<<,
881<, 82<, 83<, 84, 5<<, 881<, 82<, 83, 5<, 84<<, 881<, 82, 3<, 84<, 85<<,
881<, 82, 4<, 83<, 85<<, 881<, 82, 5<, 83<, 84<<, 881, 3<, 82<, 84<, 85<<,
881, 4<, 82<, 83<, 85<<, 881, 5<, 82<, 83<, 84<<, 881<, 82<, 83<, 84<, 85<<<
ì PiStarJoinSolve: for a finite sequence of positive integers,
generate a unique set partition P* whose block sizes are equal
to these integers, and then find all set partitions Σ such that
`
*
the join of Σ and P is the singleton partition 1
In[210]:=
PiStarJoinSolve @list_D ;
Which@HListQ@listD && TrueQ@Min@listD > 0D && Not@MemberQ@HIntegerQ ž listL, FalseDDL,
True, HListQ@listD Š False && TrueQ@Min@listD > 0D Š True &&
Not@MemberQ@HIntegerQ ž listL, FalseDD Š TrueL,
Message@PiStarJoinSolve ::notalist, listD, HListQ@listD Š True &&
TrueQ@Min@listD > 0D Š True && Not@MemberQ@HIntegerQ ž listL, FalseDD Š FalseL,
Message@PiStarJoinSolve ::notintegersinlist , listD, HListQ@listD Š True &&
TrueQ@Min@listD > 0D Š False && Not@MemberQ@HIntegerQ ž listL, FalseDD Š TrueL,
Message@PiStarJoinSolve ::integernotpositive , listD; FalseD :=
Module@8tot = Total@listD, ran, control = Transpose@
8Accumulate@Prepend@Drop@list, - 1D, 1DD, Accumulate@listD<D, pistar<, ran = Range@totD;
pistar = Table@ran@@control@@i, 1DD ;; control@@i, 2DDDD, 8i, 1, Length ž control<D;
Print@"pistar = " <> ToString@pistarDD; JoinSolve@pistarDD
é Input format: PiStarJoinSolve[list], where "list" is a list of positive integers that define the set partition P* . Each argument, for
example k, in the exist, defines a block of size k.
`
é Example: for the sequence 82, 2<, generate P* and find the joins of P* that give 1
In[211]:=
PiStarJoinSolve @82, 2<D
pistar = 881, 2<, 83, 4<<
Number of Solutions to Join Problem = 11
Out[211]=
8881, 2, 3, 4<<, 881<, 82, 3, 4<<, 881, 3, 4<, 82<<,
881, 2, 3<, 84<<, 881, 4<, 82, 3<<, 881, 2, 4<, 83<<, 881, 3<, 82, 4<<,
881<, 82, 3<, 84<<, 881<, 82, 4<, 83<<, 881, 3<, 82<, 84<<, 881, 4<, 82<, 83<<<
`
é Example: for the sequence 81, 1, 2<, generate P* and find the joins of P* that give 1
In[212]:=
PiStarJoinSolve @81, 1, 2<D
pistar = 881<, 82<, 83, 4<<
Number of Solutions to Join Problem = 5
Out[212]=
8881, 2, 3, 4<<, 881, 2, 3<, 84<<, 881, 4<, 82, 3<<, 881, 2, 4<, 83<<, 881, 3<, 82, 4<<<
`
é Example: for the sequence 82, 2, 1<, generate P* and find the joins of P* that give 1
In[213]:=
PiStarJoinSolve @82, 2, 1<D
pistar = 881, 2<, 83, 4<, 85<<
Number of Solutions to Join Problem = 25
Out[213]=
8881, 2, 3, 4, 5<<, 881<, 82, 3, 4, 5<<, 881, 3, 4, 5<, 82<<, 881, 2, 3<, 84, 5<<,
881, 4, 5<, 82, 3<<, 881, 2, 4, 5<, 83<<, 881, 3<, 82, 4, 5<<, 881, 5<, 82, 3, 4<<,
881, 3, 4<, 82, 5<<, 881, 2, 3, 5<, 84<<, 881, 4<, 82, 3, 5<<, 881, 2, 4<, 83, 5<<,
881, 3, 5<, 82, 4<<, 881<, 82, 3<, 84, 5<<, 881<, 82, 4, 5<, 83<<, 881<, 82, 3, 5<, 84<<,
881<, 82, 4<, 83, 5<<, 881, 3<, 82<, 84, 5<<, 881, 4, 5<, 82<, 83<<,
881, 3, 5<, 82<, 84<<, 881, 4<, 82<, 83, 5<<, 881, 5<, 82, 3<, 84<<,
881, 5<, 82, 4<, 83<<, 881, 3<, 82, 5<, 84<<, 881, 4<, 82, 5<, 83<<<
ì PiStarMeetAndJoinSolve: for a finite sequence of positive
integers, generate a unique set partition P* whose block sizes
are equal to these integers, and then find all set partitions Σ
`
such that the meet of Σ and P* is the singleton partition 0 and
`
*
the join of Σ and P is the singleton partition 1. This function is
used in diagram formulae.
In[214]:=
PiStarMeetAndJoinSolve @list_D ;
Which@HListQ@listD && TrueQ@Min@listD > 0D && Not@MemberQ@HIntegerQ ž listL, FalseDDL,
True, HListQ@listD Š False && TrueQ@Min@listD > 0D Š True &&
Not@MemberQ@HIntegerQ ž listL, FalseDD Š TrueL,
Message@PiStarMeetAndJoinSolve ::notalist, listD, HListQ@listD Š True &&
TrueQ@Min@listD > 0D Š True && Not@MemberQ@HIntegerQ ž listL, FalseDD Š FalseL,
Message@PiStarMeetAndJoinSolve ::notintegersinlist , listD, HListQ@listD Š True &&
TrueQ@Min@listD > 0D Š False && Not@MemberQ@HIntegerQ ž listL, FalseDD Š TrueL,
Message@PiStarMeetAndJoinSolve ::integernotpositive , listD; FalseD :=
Module@8tot = Total@listD, ran, control = Transpose@
8Accumulate@Prepend@Drop@list, - 1D, 1DD, Accumulate@listD<D, pistar<, ran = Range@totD;
pistar = Table@ran@@control@@i, 1DD ;; control@@i, 2DDDD, 8i, 1, Length ž control<D;
Print@"pistar = " <> ToString@pistarDD; MeetAndJoinSolve @pistarDD
é Input format: PiStarMeetAndJoinSolve[list], where "list" is a list of positive integers that define the set partition P* . Each
argument, for example k, in the exist, defines a block of size k.
`
`
é Example: for the sequence 82, 2<, generate P* and find the intersection of the joins of P* that give 1 and the meets of P* that give 0
In[215]:=
PiStarMeetAndJoinSolve @82, 2<D
pistar = 881, 2<, 83, 4<<
Number of Solutions to Meet Problem = 7
Number of Solutions to Meet and Join Problem = 6
Out[215]=
8881, 4<, 82, 3<<, 881, 3<, 82, 4<<, 881<, 82, 3<, 84<<,
881<, 82, 4<, 83<<, 881, 3<, 82<, 84<<, 881, 4<, 82<, 83<<<
`
é Example: for the sequence 81, 1, 2<, generate P* and find the intersection of the joins of P* that give 1 and the meets of P* that give
`
0
In[216]:=
PiStarMeetAndJoinSolve @81, 1, 2<D
pistar = 881<, 82<, 83, 4<<
Number of Solutions to Meet Problem = 10
Number of Solutions to Meet and Join Problem = 4
Out[216]=
8881, 2, 3<, 84<<, 881, 4<, 82, 3<<, 881, 2, 4<, 83<<, 881, 3<, 82, 4<<<
`
é Example: for the sequence 82, 2, 1<, generate P* and find the intersection of the joins of P* that give 1 and the meets of P* that give
`
0
In[217]:=
PiStarMeetAndJoinSolve @82, 2, 1<D
pistar = 881, 2<, 83, 4<, 85<<
Number of Solutions to Meet Problem = 27
Number of Solutions to Meet and Join Problem = 16
Out[217]=
8881, 4, 5<, 82, 3<<, 881, 3<, 82, 4, 5<<, 881, 4<, 82, 3, 5<<, 881, 3, 5<, 82, 4<<,
881<, 82, 3<, 84, 5<<, 881<, 82, 4, 5<, 83<<, 881<, 82, 3, 5<, 84<<, 881<, 82, 4<, 83, 5<<,
881, 3<, 82<, 84, 5<<, 881, 4, 5<, 82<, 83<<, 881, 3, 5<, 82<, 84<<, 881, 4<, 82<, 83, 5<<,
881, 5<, 82, 3<, 84<<, 881, 5<, 82, 4<, 83<<, 881, 3<, 82, 5<, 84<<, 881, 4<, 82, 5<, 83<<<
Product of Two Gaussian Multiple Integrals
ì ProductTwoGaussianIntegrals: computes the product
IpG Hf L IqG HgL of two Gaussian multiple integrals, one of order p ³ 1
and one of order q ³ 1; the function f has p variables and the
function g has q variables; both f and g are symmetric
functions
Namely, it computes
G
IG
p H f L Iq HgL = Úr=0 r !
pìq
p
r
q G
I
H f Är gL,
r p+q-2 r
In the displayed output of the function,
coefficient = r !
p
r
q
.
r
G
Observe that I G
p+q-2 r H f Är gL is equal to I p+q-2 r H f Är gL , where ~ denotes symmetrization.
~
In[218]:=
ProductTwoGaussianIntegrals @p_, q_D ;
Which@HTrueQ@0 £ Min@p, qDD && IntegerQ@pD && IntegerQ@qDL, True, IntegerQ@pD,
Message@ProductTwoGaussianIntegrals ::nonintegerparg , pD, IntegerQ@qD,
Message@ProductTwoGaussianIntegrals ::nonintegerqarg , qD, TrueQ@p < 0D,
Message@ProductTwoGaussianIntegrals ::negintegerp, pD, TrueQ@q < 0D,
Message@ProductTwoGaussianIntegrals ::negintegerq , qD; FalseD :=
GridAJoinA88"r", "coefficient", "integral"<<, TableA9r, r ! Binomial@p, rD Binomial@q, rD,
RowA9IGp+q-2 r , HRow@8"Hf", Spacer@2D, Subscript@FromCharacterCode @8855D, rD, ,
Spacer@2D, "gL"<DL=E=, 8r, 0, Min@p, qD<EE, Frame ® AllE
é Input format: ProductTwoGaussianIntegrals[p,q]
é Examples:
In[219]:=
ProductTwoGaussianIntegrals @1, 1D
r coefficient
Out[219]=
0
1
1
1
integral
IG2 Hf Ä0 gL
IG0 Hf Ä1 gL
G
The input functions are f Hx1 L and gHx2 L. We are computing IG
1 H f L I1 HgL. The output is
G
IG
2 H f Ä0 gL + I0 H f Ä1 gL = Ùx ¹x f Hx1 L gHx2 L GHâ x1 L GHâ x2 L + Ù f HxL gHxL ΝHâ xL.
1
2
ProductTwoGaussianIntegrals @2, 2D
In[220]:=
r coefficient
Out[220]=
0
1
1
4
2
2
integral
IG4 Hf Ä0 gL
IG2 Hf Ä1 gL
IG0 Hf Ä2 gL
G
The input functions are f Hx1 , x2 L and gHx3 , x4 L. We are computing IG
2 H f L I2 HgL. The output is
G
G
IG
4 H f Ä0 gL + 4 I2 H f Ä1 gL + 2 I0 H f Ä2 gL
= Ùx ¹...¹x f Ix1, x2 M gHx3 , x4 L GHâ x1 L ... GHâ x4 L
1
4
+4 Ùx ¹x IÙ f Ix1, x2 M gHx1 , x4 L ΝHâ x1 LM GHâ x2 L GHâ x4 L
2
4
+2 Ù f Hx1 , x2 L gHx1 , x2 L ΝHâ x1 L ΝHâ x2 L.
ProductTwoGaussianIntegrals @3, 2D
In[221]:=
r coefficient
Out[221]=
0
1
1
6
2
6
integral
IG5 Hf Ä0 gL
IG3 Hf Ä1 gL
IG1 Hf Ä2 gL
ProductTwoGaussianIntegrals @4, 2D
In[222]:=
r coefficient
Out[222]=
0
1
1
8
2
12
integral
IG6 Hf Ä0 gL
IG4 Hf Ä1 gL
IG2 Hf Ä2 gL
Product of Two Poisson Multiple Integrals
ì ProductTwoPoissonIntegrals: computes the product
`
`
N
N
Ip Hf L Iq HgL
of two Poisson multiple integrals, one of order p ³ 1 and one of
order q ³ 1; both f and g are symmetric
Namely, it computes
I pN H f L IqN HgL = Úr=0 r !
`
`
pìq
p
r
Úrl=0
q
r
r N`
I
I f *lr gM ,
l p+q-r-l
In the displayed output of the function,
coefficient = r !
p
r
q
r
r
.
l
N
N
Observe that I p+q-r-l
I f *lr gM = I p+q-r-l
I f *lr gM , where ~ denotes symmetrization.
`
`
~
N
N
Observe that I p+q-r-l
I f *lr gM = I p+q-r-l
I f *lr gM , where ~ denotes symmetrization.
`
In[223]:=
`
~
ProductTwoPoissonIntegrals @p_, q_D ;
Which@HTrueQ@0 £ Min@p, qDD && IntegerQ@pD && IntegerQ@qDL, True,
IntegerQ@pD, Message@ProductTwoPoissonIntegrals ::nonintegerparg , pD,
IntegerQ@qD, Message@ProductTwoPoissonIntegrals ::nonintegerqarg , qD,
TrueQ@p < 0D, Message@ProductTwoPoissonIntegrals ::negintegerp, pD,
TrueQ@q < 0D, Message@ProductTwoPoissonIntegrals ::negintegerq , qD; FalseD :=
GridBJoinB88"r", "l", "coefficient", "integral"<<,
PartitionBFlattenBTableB:r, l, r ! Binomial@p, rD Binomial@q, rD Binomial@r, lD,
RowB:INp+q-r-l , HRow@8"Hf", Spacer@2D, Subsuperscript @FromCharacterCode @42D, r, lD,
`
Spacer@2D, "gL"<DL>F>, 8r, 0, Min@p, qD<, 8l, 0, r<FF, 4FF, Frame ® AllF
ì
Input format: ProductTwoPoissonIntegrals[p,q]
In[224]:=
ProductTwoPoissonIntegrals @1, 1D
r l coefficient integral
IN2 Hf *00 gL
`
0 0
1
1 0
1
1 1
1
IN1 Hf *01 gL
`
Out[224]=
IN0 Hf *11 gL
`
Thus,
I1N H f L I1N HgL = I2N I f *00 gM + I1N I f *01 gM + I0N I f *11 gM
`
`
`
`
`
`
`
= Ùx¹y f HxL gHyL N Hâ xL N Hâ yL
`
+Ù f HxL gHxL N Hâ xL
+Ù f HxL gHxL ΝHâ xL
`
`
= Ùx¹y f HxL gHyL N Hâ xL N Hâ yL + Ù f HxL gHxL NHâ xL.
In[225]:=
ProductTwoPoissonIntegrals @2, 1D
r l coefficient integral
IN3 Hf *00 gL
`
0 0
1
1 0
2
1 1
2
IN2 Hf *01 gL
`
Out[225]=
IN1 Hf *11 gL
`
Thus,
I2N H f L I1N HgL = I3N I f *00 gM + 2 I2N I f *01 gM + 2 I0N I f *11 gM
`
`
`
`
`
`
`
`
= Ùx ¹x ¹y f Hx1 , x2 L gHyL N Hâ x1 L N Hâ x2 L N Hâ yL
1
2
`
`
+2 Ùx¹y f Hx, yL gHyL N Hâ xL N Hâ yL
`
`
+2 Ùx¹y f Hx, yL gHyL N Hâ xL N Hâ yL
`
+2 Ù f Hx, yL gHyL ΝHâ yL N Hâ xL.
In[226]:=
ProductTwoPoissonIntegrals @4, 2D
r l coefficient integral
IN6 Hf *00 gL
`
0 0
1
1 0
8
1 1
8
2 0
12
2 1
24
2 2
12
IN5 Hf *01 gL
`
IN4 Hf *11 gL
`
Out[226]=
IN4 Hf *02 gL
`
IN3 Hf *12 gL
`
IN2 Hf *22 gL
`
Thus, I4N H f L I2N HgL = I6N I f *00 gM + 8 I5N I f *01 gM + 8 I4N I f *11 gM + 12 I4N I f *02 gM + 24 I3N I f *12 gM + 12 I2N I f *22 gM. For instance,
`
`
`
`
I3N I f *12 gM = Ùx ¹x ¹y f Hx1 , x2 , y1 , y2 L gHy1 , y2 L ΝHâ y2 L N Hâ x1 L N Hâ x2 L N Hâ y1 L.
`
`
1
`
2
`
`
`
`
`
1
MSets and MZeroSets
ì MSets: this function produces the same output as
PiStarMeetAndJoinSolve
ì MSetsEqualTwo: this function produces all solutions to
PiStarMeetAndJoinSolve containing partitions only of size two
ì MSetsGreaterEqualTwo: this function produces all solutions to
PiStarMeetAndJoinSolve containing no singletons
In[227]:=
In[228]:=
In[229]:=
MSets@list_D := PiStarMeetAndJoinSolve @listD
MSetsEqualTwo @list_D := Block@8input = PiStarMeetAndJoinSolve @listD, output<,
output = Select@input, Union@Length ž ðD Š 82< &D;
Print@"Number of Solutions to this Problem = " <> ToString@Length@outputDDD; outputD
MSetsGreaterEqualTwo @list_D := Block@8input = PiStarMeetAndJoinSolve @listD, output<,
output = Select@input, Min@Length ž ðD > 1 &D;
Print@"Number of Solutions to this Problem = " <> ToString@Length@outputDDD; outputD
é Input format: MSets[list], MSetsEqualTwo[list], and MSetsGreaterEqualTwo[list], where "list" is a list of positive integers that
define the set partition P* . Each argument, for example k, in the list, defines a block of size k
é Example: Consider P* = 881, 2<, 83, 4<< and compute the three MSets functions.
In[230]:=
MSets@82, 2<D
pistar = 881, 2<, 83, 4<<
Number of Solutions to Meet Problem = 7
Number of Solutions to Meet and Join Problem = 6
Out[230]=
In[231]:=
8881, 4<, 82, 3<<, 881, 3<, 82, 4<<, 881<, 82, 3<, 84<<,
881<, 82, 4<, 83<<, 881, 3<, 82<, 84<<, 881, 4<, 82<, 83<<<
MSetsEqualTwo @82, 2<D
pistar = 881, 2<, 83, 4<<
Number of Solutions to Meet Problem = 7
Number of Solutions to Meet and Join Problem = 6
Number of Solutions to this Problem = 2
Out[231]=
In[232]:=
8881, 4<, 82, 3<<, 881, 3<, 82, 4<<<
MSetsGreaterEqualTwo @82, 2<D
pistar = 881, 2<, 83, 4<<
Number of Solutions to Meet Problem = 7
Number of Solutions to Meet and Join Problem = 6
Number of Solutions to this Problem = 2
Out[232]=
8881, 4<, 82, 3<<, 881, 3<, 82, 4<<<
é Example: Consider P* = 881, 2<, 83<, 84<< and compute the three Gaussian set functions.
In[233]:=
MSetsEqualTwo @82, 1, 1<D
pistar = 881, 2<, 83<, 84<<
Number of Solutions to Meet Problem = 10
Number of Solutions to Meet and Join Problem = 4
Number of Solutions to this Problem = 2
Out[233]=
8881, 4<, 82, 3<<, 881, 3<, 82, 4<<<
é Example: A case for where the cardinality of P* is odd and, therefore, one gets an empty output when executing MSetsEqualTwo.
In[234]:=
MSetsEqualTwo @82, 2, 1<D
pistar = 881, 2<, 83, 4<, 85<<
Number of Solutions to Meet Problem = 27
Number of Solutions to Meet and Join Problem = 16
Number of Solutions to this Problem = 0
Out[234]=
8<
ì MZeroSets: this function produces the same output as
PiStarMeetSolve
ì MZeroSetsEqualTwo: this function produces all solutions to
PiStarMeetSolve containing partitions only of size two
ì MZeroSetsGreaterEqualTwo: this function produces all
solutions to PiStarMeetSolve containing no singletons
In[235]:=
In[236]:=
In[237]:=
MZeroSets@list_D := PiStarMeetSolve @listD
MZeroSetsEqualTwo @list_D := Block@8input = PiStarMeetSolve @listD, output<,
output = Select@input, Union@Length ž ðD Š 82< &D;
Print@"Number of Solutions to this Problem = " <> ToString@Length@outputDDD; outputD
MZeroSetsGreaterEqualTwo @list_D :=
Block@8input = PiStarMeetSolve @listD, output<, output = Select@input, Min@Length ž ðD > 1 &D;
Print@"Number of Solutions to this Problem = " <> ToString@Length@outputDDD; outputD
é Input format: MZeroSets[list], MZeroSetsEqualTwo[list], and MZeroSetsGreaterEqualTwo[list], where "list" is a list of positive
integers that define the set partition P* . Each argument, for example k, in the exist, defines a block of size k.
é Example: Consider P* = 881, 2<, 83, 4<< and compute the three MZeroSets functions.
In[238]:=
MZeroSets@82, 2<D
pistar = 881, 2<, 83, 4<<
Number of Solutions to Meet Problem = 7
Out[238]=
8881, 4<, 82, 3<<, 881, 3<, 82, 4<<, 881<, 82, 3<, 84<<,
881<, 82, 4<, 83<<, 881, 3<, 82<, 84<<, 881, 4<, 82<, 83<<, 881<, 82<, 83<, 84<<<
In[239]:=
MZeroSetsEqualTwo @82, 2<D
pistar = 881, 2<, 83, 4<<
Number of Solutions to Meet Problem = 7
Number of Solutions to this Problem = 2
Out[239]=
In[240]:=
8881, 4<, 82, 3<<, 881, 3<, 82, 4<<<
MZeroSetsGreaterEqualTwo @82, 2<D
pistar = 881, 2<, 83, 4<<
Number of Solutions to Meet Problem = 7
Number of Solutions to this Problem = 2
Out[240]=
8881, 4<, 82, 3<<, 881, 3<, 82, 4<<<
é Example: Consider P* = 881, 2<, 83<, 84<< and compute MZeroSetsEqualTwo.
In[241]:=
MZeroSetsEqualTwo @82, 1, 1<D
pistar = 881, 2<, 83<, 84<<
Number of Solutions to Meet Problem = 10
Number of Solutions to this Problem = 2
Out[241]=
8881, 4<, 82, 3<<, 881, 3<, 82, 4<<<
é Example: A case where the cardinality of P* is odd and, therefore, the output is empty when executing MZeroSetsEqualTwo.
In[242]:=
MZeroSetsEqualTwo @82, 2, 1<D
pistar = 881, 2<, 83, 4<, 85<<
Number of Solutions to Meet Problem = 27
Number of Solutions to this Problem = 0
Out[242]=
8<
Hermite Polynomials
ì Hermite-Rho: computes Hermite polynomials with a leading
coefficient of 1 and parameter Ρ ³ 0. They are orthogonal with
respect to the Gaussian distribution with mean zero and
1
2
variance Ρ. The generating function is ãt x- 2 Ρ t .
These polynomials are defined by
Hn Hx, ΡL = H- ΡLn ãx
and satisfy
2
n
‘2 Ρ â
âx n
ã-x
2
‘2 Ρ
, n ³ 0,
and satisfy
Hn Hx, ΡL = Úk=0
Pn2T
In[243]:=
n
H2 k - 1L!! H- ΡLk x n-2 k , n ³ 0, Ρ > 0.
2k
HermiteRho@n_, x_, Ρ_ D :=
SumABinomial@n, 2 kD H2 k - 1L !! * H- ΡLk * xn-2 k , 8k, 0, IntegerPart@n  2D<E
é Example: compute the Hermite-Rho polynomial of order 5 with a leading coefficient of 1
In[244]:=
HermiteRho@5, x, ΡD
Out[244]=
x5 - 10 x3 Ρ + 15 x Ρ2
ì HermiteRhoGrid: display the Hermite-Rho polynomials up to
order n, using a leading coefficient of 1 for each polynomial
In[245]:=
HermiteRhoGrid @n_D :=
Grid@H8ð, HermiteRho@ð, x, ΡD<  ExpandL & ž Range@0, n, 1D, Frame ® AllD
é Example: Make a grid of the first 11 Hermite-Rho polynomials
In[246]:=
HermiteRhoGrid @10D
0
1
1
x
x2 - Ρ
2
x3
3
Out[246]=
x5 - 10 x3 Ρ + 15 x Ρ2
5
x6
6
x7
7
8
9
-3xΡ
x4 - 6 x2 Ρ + 3 Ρ2
4
x8
x9
- 15 x4 Ρ + 45 x2 Ρ2 - 15 Ρ3
- 21 x5 Ρ + 105 x3 Ρ2 - 105 x Ρ3
- 28 x6 Ρ + 210 x4 Ρ2 - 420 x2 Ρ3 + 105 Ρ4
- 36 x7 Ρ + 378 x5 Ρ2 - 1260 x3 Ρ3 + 945 x Ρ4
10 x10 - 45 x8 Ρ + 630 x6 Ρ2 - 3150 x4 Ρ3 + 4725 x2 Ρ4 - 945 Ρ5
ì Hermite: computes Hermite polynomials with a leading
coefficient of 1. These polynomials are obtained by setting
Ρ = 1 and are defined as
Hn HxL = H-1Ln ãx
In[247]:=
Hermite@n_, x_D := 2-n2 HermiteHBn, x ’
2
n
‘2 â
âx n
ã-x
2 F  Expand
2
‘2
, n ³ 0.
é Example: compute the Hermite polynomial of order 5 with a leading coefficient of 1
In[248]:=
Hermite@5, xD  TraditionalForm
Out[248]//TraditionalForm=
x5 - 10 x3 + 15 x
ì HermiteGrid: display the Hermite polynomials up to order n,
using a leading coefficient of 1 for each polynomial
In[249]:=
HermiteGrid @n_D := Grid@H8ð, Hermite@ð, xD<  ExpandL & ž Range@0, n, 1D, Frame ® AllD
é Example: Make a grid of the first 11 Hermite polynomials
In[250]:=
HermiteGrid @10D  TraditionalForm
Out[250]//TraditionalForm=
0
1
1
x
2
x2 - 1
x3 - 3 x
3
4
x - 6 x2 + 3
4
5
x - 10 x3 + 15 x
5
6
x - 15 x4 + 45 x2 - 15
6
7
x - 21 x5 + 105 x3 - 105 x
7
8
x8 - 28 x6 + 210 x4 - 420 x2 + 105
9
9
x - 36 x7 + 378 x5 - 1260 x3 + 945 x
10
10 x - 45 x8 + 630 x6 - 3150 x4 + 4725 x2 - 945
é Example: Plot H5 HxL for -5 £ x £ 5
In[251]:=
Plot@Hermite@5, xD, 8x, - 5, 5<D
200
100
Out[251]=
-4
-2
2
-100
-200
4
é Example: Plot Hk HxL for k = 0, ..., 6 and -5 £ x £ 5
In[252]:=
Plot@Evaluate@Hermite@ð, xD & ž Range@0, 6, 1DD, 8x, - 5, 5<, PlotStyle ® 8<D
60
40
20
Out[252]=
-4
-2
2
4
-20
-40
Note: The built-in Mathematica function HermiteH[n,x] is defined as
HermiteH@n, xD = H-1Ln ãx
2
ân
âx n
2
ã-x , n ³ 0.
One has
Hn HxL = 2-n2 HermiteHBn,
x
2
F, n ³ 0.
Poisson-Charlier Polynomials
ì Charlier: computes the Poisson-Charlier Polynomials. There
are orthogonal with respect to the Poisson distribution with
mean a.
These polynomials satisfy the orthogonality relation
-a k
a ‘ k ! = a-n n! ∆nm
Ú¥
k=0 cn Hk, aL cm Hk, aL ã
and the recursion relation
cn Hx, aL = a-1 x cn-1 Hx - 1, aL - cn-1 Hx, aL, n ³ 1, with c0 Hx, aL = 1.
In[253]:=
Charlier@0, x_, a_D = 1;
In[254]:=
Charlier@n_, x_, a_D := ExpandAIx a-1 Charlier@n - 1, x - 1, aD - Charlier@n - 1, x, aDME
é Example: compute the Poisson-Charlier polynomial with n = 8
In[255]:=
Collect@Charlier@8, x, aD, 8x, a<D  TraditionalForm
Out[255]//TraditionalForm=
x8
a
8
28
+ a
6769
a
8
-
8
a
a
13 068
a8
a
5880
+
8
a
a
a
a
70
+
5
a
4
1960
a
a4
a
a
28
+
a3
420
-
7
a
12 992
-
8
168
+
1400
-
8
13 132
a
770
+
a5
x6 + -
6
x4 + -
2800
+
a6
28
+
7
560
+
7672
+
a7
6
168
+
8
2380
+
7
14 112
+
322
x7 +
7
a
1960
-
6
a
5040
420
-
5
a
5760
-
a8
x5 +
a5
6300
-
7
x2 + -
a2
56
-
6
a7
56
-
4
3360
-
a6
a3
x3 +
1344
-
a5
420
-
a4
112
-
a3
28
-
a2
8
-
x+1
a
é Example: compute the Poisson-Charlier polynomial with n = 8 and a = 1
In[256]:=
Collect@Charlier@8, x, 1D, xD  TraditionalForm
Out[256]//TraditionalForm=
x8 - 36 x7 + 518 x6 - 3836 x5 + 15 659 x4 - 34 860 x3 + 38 618 x2 - 16 072 x + 1
ì CharlierGrid: display the Poisson-Charlier polynomials up to
order n with Poisson mean a
é Example: make a grid of the Poisson-Charlier polynomials for 0 £ n £ 5
In[257]:=
In[258]:=
ChalierGrid @n_, a_D :=
Grid@Table@8j, Collect@Charlier@j, x, aD, 8x, a<D<, 8j, 0, n<D, Frame ® AllD
ChalierGrid @5, aD  TraditionalForm
Out[258]//TraditionalForm=
0
1
x
1
2
x3
3
x4
4
5
+ I-
x2
x5
a5
+ I-
a4
10
a5
-
+ I-
M x4 + I
4
a3
6
a4
5
35
a
a5
+
4
a3
30
a4
+ I-
a2
3
a3
Mx +I
3
+
-
11
a4
3
1
a2
-1
- Mx+1
2
Mx +I
2
a2
+
a
12
a3
M x3 + I3
10
50
a
a5
+
-
6
a2
a
2
+
a3
3
a2
+ Mx-1
M x + I-
55
a4
2
-
30
a3
-
3
a
6
a4
-
8
a3
-
M x2 + I
2
6
a2
10
24
a
a5
- Mx+1
4
a
+
30
a4
+
20
a3
+
10
a2
+ Mx-1
5
a
é Example: Plot the Poisson-Charlier polynomial with n = 5 and a = 1  2 over the interval -1 £ x £ 3
In[259]:=
Plot@Charlier@5, x, 0.5D, 8x, - 1, 3<, PlotRange ® AllD
-1
1
2
3
-1000
-2000
-3000
Out[259]=
-4000
-5000
-6000
é Example: Plot the Poisson-Charlier polynomial with n = 5 and a = 1 over the interval -1 £ x £ 3
In[260]:=
Plot@Charlier@5, x, 1D, 8x, - 1, 3<, PlotRange ® AllD
-1
1
2
3
-50
-100
-150
Out[260]=
-200
-250
-300
é Example: Plot the Poisson-Charlier polynomial with n = 5 and a = 2 over the interval -1 £ x £ 3
In[261]:=
Plot@Charlier@5, x, 2D, 8x, - 1, 3<, PlotRange ® AllD
-1
1
-5
-10
Out[261]=
-15
-20
-25
2
3
é Example: Plot the Poisson-Charlier polynomials with a = 1 and 1 £ n £ 6 over the interval -1 £ x £ 1
In[262]:=
Plot@Evaluate@Charlier@ð, x, 1D & ž Range@1, 6DD, 8x, - 1, 1<, PlotStyle ® 8<D
40
20
Out[262]=
-1.0
-0.5
0.5
1.0
-20
-40
ì Charlier-Centered: computes the centered Poisson-Charlier
polynomials.
These polynomials are defined by
Cn Hx, aL = an cn Hx + a, aL, n ³ 0.
In[263]:=
CharlierCentered @0, x_, a_D = 1;
In[264]:=
CharlierCentered @n_, x_, a_D := Expand@Han Charlier@n, x + a, aDLD
é Example: compute the centered Poisson-Charlier polynomial with n = 8
In[265]:=
CharlierCentered @8, x, aD  TraditionalForm
Out[265]//TraditionalForm=
105 a4 - 420 a3 x2 + 2100 a3 x - 2380 a3 + 210 a2 x4 - 2380 a2 x3 + 9310 a2 x2 14 532 a2 x + 7308 a2 - 28 a x6 + 532 a x5 - 3920 a x4 + 14 084 a x3 - 25 284 a x2 +
20 376 a x - 5040 a + x8 - 28 x7 + 322 x6 - 1960 x5 + 6769 x4 - 13 132 x3 + 13 068 x2 - 5040 x
é Example: compute the centered Poisson-Charlier polynomial with n = 8 and a = 1
In[266]:=
CharlierCentered @8, x, 1D  TraditionalForm
Out[266]//TraditionalForm=
x8 - 28 x7 + 294 x6 - 1428 x5 + 3059 x4 - 1428 x3 - 3326 x2 + 2904 x - 7
é Example: Plot the centered Poisson-Charlier polynomials witha = 1 and 1 £ n £ 6 over the interval -1 £ x £ 1
In[267]:=
Plot@Evaluate@CharlierCentered @ð, x, 1D & ž Range@1, 6DD, 8x, - 1, 1<, PlotRange ® AllD
20
-1.0
Out[267]=
-0.5
0.5
1.0
-20
-40
-60
ì CharlierCenteredGrid: display the centered Poisson-Charlier
polynomials up to order n
é Example: make a grid of the centered Poisson-Charlier polynomials for 0 £ n £ 5
In[268]:=
In[269]:=
ChalierCenteredGrid @n_, a_D := TraditionalForm @ð, ParameterVariables ¦ aD & ž
Grid@Table@8j, Collect@CharlierCentered @j, x, aD, 8x, a<D<, 8j, 0, n<D, Frame ® AllD
ChalierCenteredGrid @5, aD
Out[269]//TraditionalForm=
0
1
1
x
2
x - 3 x + H2 - 3 aL x + 2 a
3
4
x2 - x - a
3
2
x4 - 6 x3 + H11 - 6 aL x2 + H14 a - 6L x + 3 a2 - 6 a
5 x5 - 10 x4 + H35 - 10 aL x3 + H50 a - 50L x2 + H15 a2 - 70 a + 24L x - 20 a2 + 24 a
Download