(*^ ::[paletteColors = 128; automaticGrouping; currentKernel; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e8, 24, "Times"; ; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e6, 18, "Times"; ; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, L1, e6, 14, "Times"; ; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, L1, a20, 18, "Times"; ; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, L1, a15, 14, "Times"; ; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, L1, a12, 12, "Times"; ; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; ; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; ; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; ; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, L1, 12, "Courier"; ; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, L1, 10, "Times"; ; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = Left Header, inactive, 12; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, L1, 12; fontset = Left Footer, inactive, 12; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; next21StandardFontEncoding; ] :[font = title; inactive; preserveAspect; startGroup; ] Functions Introduction and Examples :[font = subsubtitle; inactive; preserveAspect; ] Brett van de Sande March 18, 1992 :[font = text; inactive; preserveAspect; ] Functions.m is a general purpose package centered around the function ipoly[f,x,a,b] which integrates f over an arbitrary polytope with finite volume. It includes routines for linear coordinate transforms, handling delta functions, moving the integration to the inside or outside of an expression and evaluating the integral for some or all of the coordinates. The polytope is described by the J inequalities a.x<=b where x is the n dimensional coordinate vector, a is a J by n matrix and b is a J-vector. (ipoly, transform, translate, rotate, ipolyexpand, ipolyfactor, delta Big, showpoly, TestValue and convert) In the same manner, it defines the summation function sum[?] which works like Sum[?]. It includes routines for handling Kronecker delta functions and moving the summation to the inside or outside of expressions and evaluating the summation for some or all of the coordinates. (sum, sumexpand, sumfactor, delta, and convert) The complex conjugate operator is extended to handle algebraic expressions and a normal ordering operator NormalOrder is defined. (NormalOrder) There are also rules for expanding expressions involving Dot and NonCommutativeMultiply. The trace of a matrix is defined. (Dotexpand, timesexpand, trace, CnumberQ, ScalarQ) :[font = text; inactive; preserveAspect; ] I am a graduate student in the Ohio State University department of physics where I am specializing in Quantum Field theory. I wrote this package to help with some rather long algebraic calculations in Light Cone QCD. Although, this package provides a mathematical framework for defining the physical theory, none of the physics itself has been included. I may be contacted by E-mail at vandesande@ohstpy or by phone at 614 292 0556. :[font = input; preserveAspect; ] <g[a+b]; :[font = text; inactive; preserveAspect; ] When the rule is used, Mma tries to apply the rule to all occurances of Plus, taking a large amount of time for large expressions: :[font = input; preserveAspect; startGroup; ] tt=Sum[g[h[i]],{i,1,250}]; Timing[tt//.rule;] :[font = output; output; inactive; preserveAspect; endGroup; ] {8.4*Second, Null} ;[o] {8.4 Second, Null} :[font = text; inactive; preserveAspect; ] Using the extension to ReplaceRepeated applies the rule only to expressions containing g as a subexpression, using much less time: :[font = input; preserveAspect; startGroup; ] Timing[tt//.(rule,g);] :[font = output; output; inactive; preserveAspect; endGroup; ] {0.5666666666666666*Second, Null} ;[o] {0.566667 Second, Null} :[font = text; inactive; preserveAspect; endGroup; ] An example where this is a real time saver is in the application of sumfactor or ipolyfactor to very large expressions. :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] Extensions to inequalities and Sign :[font = text; inactive; preserveAspect; ] Use TestValue do define a numerical value for various quantities. :[font = input; preserveAspect; ] f/:TestValue[f]=1; g/:TestValue[g]=2; h/:TestValue[h]=-3/2; :[font = text; inactive; preserveAspect; ] When an inequality or Sign is evaluated, the TestValue of any symbols are used. :[font = input; preserveAspect; startGroup; ] f<=2-g :[font = output; output; inactive; preserveAspect; endGroup; ] False ;[o] False :[font = input; preserveAspect; startGroup; ] f h g[- + y, - - y], {x, y}, ..] 2 2 :[font = text; inactive; preserveAspect; ] ipolyexpand moves ipoly to the inside of an expression as much as possible, removing delta functions. It can also handle expressions involving NonCommutativeMultiply and Dot. :[font = input; preserveAspect; startGroup; ] %//.ipolyexpand :[font = output; output; inactive; preserveAspect; endGroup; ] 2*a*ipoly[f[-2*y, -4*y], {y}, {{2}, {-6}}, {0, 1}] + ipoly[g[x/2 + y, x/2 - y], {x, y}, {{-1/2, -1}, {1, 0}, {-1/2, 1}}, {0, 1, 1}] ;[o] 2 a ipoly[f[-2 y, -4 y], {y}, ..] + x x > ipoly[g[- + y, - - y], {x, y}, ..] 2 2 :[font = text; inactive; preserveAspect; ] ipolyfactor moves ipoly to the outside of the expression as much as possible. It can also handle expressions involving NonCommutativeMultiply and Dot. Use %//.(ipolyfactor,ipoly) for very large expressions. :[font = input; preserveAspect; startGroup; ] %//.ipolyfactor :[font = output; output; inactive; preserveAspect; endGroup; ] ipoly[2*a*f[-2*y, -4*y], {y}, {{-6}, {2}}, {1, 0}] + ipoly[g[x/2 + y, x/2 - y], {x, y}, {{-1/2, -1}, {-1/2, 1}, {1, 0}}, {0, 1, 1}] ;[o] ipoly[2 a f[-2 y, -4 y], {y}, ..] + x x > ipoly[g[- + y, - - y], {x, y}, ..] 2 2 :[font = text; inactive; preserveAspect; ] convert converts some or all of the coordinates to a format suitable for the internal function Integrate. :[font = input; preserveAspect; startGroup; ] convert[%[[2]],Integrate,{2}] :[font = output; output; inactive; preserveAspect; endGroup; ] ipoly[Integrate[g[x/2 + y, x/2 - y], {y, -x/2, 1 + x/2}], {x}, {{1}, {-1}}, {1, 1}] ;[o] x x -x x ipoly[Integrate[g[- + y, - - y], {y, --, 1 + -}], {x}, ..] 2 2 2 2 :[font = text; inactive; preserveAspect; ] Using Big, one can define integrals from -Infinity to Infinity. Any symbol used in defining the polytope (such as bb below) must have a TestValue assigned to it: :[font = input; preserveAspect; startGroup; ] bb/:TestValue[bb]=5; ipoly[ f[p,q] Exp[I k c(p-q)], {p,q,k}, {0<=p,0<=q,p+q<=2 bb-1,k<=Big,-Big<=k} ] :[font = output; output; inactive; preserveAspect; endGroup; ] ipoly[E^(I*c*k*(p - q))*f[p, q], {p, q, k}, {{-1, 0, 0}, {0, -1, 0}, {1, 1, 0}, {0, 0, 1}, {0, 0, -1}}, {0, 0, -(1 - 2*bb), Big, Big}] ;[o] I c k (p - q) ipoly[E f[p, q], {p, q, k}, ..] :[font = text; inactive; preserveAspect; ] Dirac delta functions are produced in the correct manner, :[font = input; preserveAspect; startGroup; ] convert[%,Integrate,{3}] :[font = output; output; inactive; preserveAspect; endGroup; ] ipoly[2*Pi*delta[c*p - c*q]*f[p, q], {p, q}, {{-1, 0}, {0, -1}, {1, 1}}, {0, 0, -(1 - 2*bb)}] ;[o] ipoly[2 Pi delta[c p - c q] f[p, q], {p, q}, ..] :[font = text; inactive; preserveAspect; ] ipolyfactor also combines various products of ipoly, :[font = input; preserveAspect; startGroup; ] ipoly[f[x],{x},{0<=x,x<=1}]* ipoly[g[x],{x},{1<=x,x<=2}]//.ipolyfactor :[font = output; output; inactive; preserveAspect; endGroup; endGroup; ] ipoly[f[xis1]*g[x], {xis1, x}, {{-1, 0}, {0, -1}, {0, 1}, {1, 0}}, {0, -1, 2, 1}] ;[o] ipoly[f[xis1] g[x], {xis1, x}, ..] :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] Summations :[font = text; inactive; preserveAspect; ] sum evaluates the summations from left to right. :[font = input; preserveAspect; startGroup; ] sum[ g[i,j,k]+a delta[i,j] f[i,j,k], {i,1,k},{j,1,k},{k,1,5} ] :[font = output; output; inactive; preserveAspect; endGroup; ] sum[a*delta[i, j]*f[i, j, k] + g[i, j, k], {i, 1, k}, {j, 1, k}, {k, 1, 5}] ;[o] sum[a delta[i, j] f[i, j, k] + g[i, j, k], {i, 1, k}, > {j, 1, k}, {k, 1, 5}] :[font = text; inactive; preserveAspect; ] ipolyexpand moves ipoly to the inside of an expression as much as possible, removing Kronecker delta functions. It can also handle expressions involving NonCommutativeMultiply and Dot. It handles only the simplest delta functions. :[font = input; preserveAspect; startGroup; ] %//.sumexpand :[font = output; output; inactive; preserveAspect; endGroup; ] a*sum[f[j, j, k], {j, 1, k}, {k, 1, 5}] + sum[g[i, j, k], {i, 1, k}, {j, 1, k}, {k, 1, 5}] ;[o] a sum[f[j, j, k], {j, 1, k}, {k, 1, 5}] + > sum[g[i, j, k], {i, 1, k}, {j, 1, k}, {k, 1, 5}] :[font = text; inactive; preserveAspect; ] ipolyfactor moves ipoly to the outside of the expression as much as possible. It can also handle expressions involving NonCommutativeMultiply and Dot. Use %//.(sumfactor,sum) for very large expressions. :[font = input; preserveAspect; startGroup; ] %//.sumfactor :[font = output; output; inactive; preserveAspect; endGroup; ] sum[a*f[j, j, k], {j, 1, k}, {k, 1, 5}] + sum[g[i, j, k], {i, 1, k}, {j, 1, k}, {k, 1, 5}] ;[o] sum[a f[j, j, k], {j, 1, k}, {k, 1, 5}] + > sum[g[i, j, k], {i, 1, k}, {j, 1, k}, {k, 1, 5}] :[font = text; inactive; preserveAspect; ] convert converts some or all of the coordinates to a format suitable for the internal function Sum. :[font = input; preserveAspect; startGroup; ] convert[%[[2]],Sum,{2}] :[font = output; output; inactive; preserveAspect; endGroup; ] sum[Sum[g[i, j, k], {j, 1, k}], {i, 1, k}, {k, 1, 5}] ;[o] sum[Sum[g[i, j, k], {j, 1, k}], {i, 1, k}, {k, 1, 5}] :[font = text; inactive; preserveAspect; ] sumfactor also combines various products of sums. :[font = input; preserveAspect; startGroup; ] sum[f[i],{i,1,3,1/2}] sum[g[i],{i,2,5}]/.sumfactor :[font = output; output; inactive; preserveAspect; endGroup; endGroup; ] sum[f[iis1]*g[i], {iis1, 1, 3, 1/2}, {i, 2, 5}] ;[o] 1 sum[f[iis1] g[i], {iis1, 1, 3, -}, {i, 2, 5}] 2 :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] Manupulating non-commutative symbols :[font = text; inactive; preserveAspect; ] Define some symbols to be noncommutative: :[font = input; preserveAspect; ] c1/:CnumberQ[c1]=False; c2/:CnumberQ[c2]=False; c3/:CnumberQ[c3]=False; :[font = text; inactive; preserveAspect; ] timesexpand will simplify expressions involving NonCommutativeMultiply :[font = input; preserveAspect; startGroup; ] (2 c1)**(c1+c2**a**c3)**c1//.timesexpand :[font = output; output; inactive; preserveAspect; endGroup; ] 2*(c1 ** c1 ** c1 + a*c1 ** c2 ** c3 ** c1) ;[o] 2 (c1 ** c1 ** c1 + a c1 ** c2 ** c3 ** c1) :[font = text; inactive; preserveAspect; ] Conjugate works for algebraic expressions: :[font = input; preserveAspect; startGroup; ] Conjugate[%] :[font = output; output; inactive; preserveAspect; fontLeading = 0; endGroup; ] 2*(Conjugate[c1] ** Conjugate[c1] ** Conjugate[c1] + Conjugate[a]*Conjugate[c1] ** Conjugate[c3] ** Conjugate[c2] ** Conjugate[c1]) ;[o] __ __ __ _ __ __ __ __ 2 (c1 ** c1 ** c1 + a c1 ** c3 ** c2 ** c1) :[font = text; inactive; preserveAspect; ] A normal ordering operator is defined in a manner consistant with standard creation and annihilation operators used in quantum mechanics. The hermetian conjugates must be explicit. :[font = input; preserveAspect; startGroup; ] NormalOrder[c2**Conjugate[c3]**c1] :[font = output; output; inactive; preserveAspect; fontLeading = 0; endGroup; ] NormalOrder[c2 ** Conjugate[c3]] ** c1 ;[o] __ :c2 ** c3: ** c1 :[font = text; inactive; preserveAspect; ] In a similar way nonscalar symbols can be defined for Dot :[font = input; preserveAspect; ] s1/:ScalarQ[s1]=False; s2/:ScalarQ[s2]=False; :[font = text; inactive; preserveAspect; ] Dotexpand expands expressions involving Dot allowing for the case of non-commuting symbols :[font = input; preserveAspect; startGroup; ] (c3 s1).(c2 s2+s1 a)//.Dotexpand :[font = output; output; inactive; preserveAspect; endGroup; ] c3 ** ((s1 . s1) ** a + (s1 . s2) ** c2) ;[o] c3 ** ((s1 . s1) ** a + (s1 . s2) ** c2) :[font = input; preserveAspect; startGroup; ] %//.timesexpand :[font = output; output; inactive; preserveAspect; endGroup; ] a*c3*s1 . s1 + s1 . s2*c3 ** c2 ;[o] a c3 s1 . s1 + s1 . s2 c3 ** c2 :[font = text; inactive; preserveAspect; ] trace is also expanded by Dotexpand :[font = input; preserveAspect; startGroup; ] trace[s1.(a s2+s1)]//.Join[Dotexpand,timesexpand] :[font = output; output; inactive; preserveAspect; endGroup; endGroup; endGroup; ] trace[s1 . s1] + a*trace[s1 . s2] ;[o] trace[s1 . s1] + a trace[s1 . s2] ^*)