Functions Introduction and Examples Brett van de Sande March 18, 1992 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) 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. <g[a+b]; 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: tt=Sum[g[h[i]],{i,1,250}]; Timing[tt//.rule;] {8.4 Second, Null} Using the extension to ReplaceRepeated applies the rule only to expressions containing g as a subexpression, using much less time: Timing[tt//.(rule,g);] {0.566667 Second, Null} An example where this is a real time saver is in the application of sumfactor or ipolyfactor to very large expressions. Extensions to inequalities and Sign Use TestValue do define a numerical value for various quantities. f/:TestValue[f]=1; g/:TestValue[g]=2; h/:TestValue[h]=-3/2; When an inequality or Sign is evaluated, the TestValue of any symbols are used. f<=2-g False f h g[- + y, - - y], {x, y}, ..] 2 2 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. %//.ipolyexpand 2 a ipoly[f[-2 y, -4 y], {y}, ..] + x x > ipoly[g[- + y, - - y], {x, y}, ..] 2 2 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. %//.ipolyfactor ipoly[2 a f[-2 y, -4 y], {y}, ..] + x x > ipoly[g[- + y, - - y], {x, y}, ..] 2 2 convert converts some or all of the coordinates to a format suitable for the internal function Integrate. convert[%[[2]],Integrate,{2}] x x -x x ipoly[Integrate[g[- + y, - - y], {y, --, 1 + -}], {x}, ..] 2 2 2 2 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: 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} ] I c k (p - q) ipoly[E f[p, q], {p, q, k}, ..] Dirac delta functions are produced in the correct manner, convert[%,Integrate,{3}] ipoly[2 Pi delta[c p - c q] f[p, q], {p, q}, ..] ipolyfactor also combines various products of ipoly, ipoly[f[x],{x},{0<=x,x<=1}]* ipoly[g[x],{x},{1<=x,x<=2}]//.ipolyfactor ipoly[f[xis1] g[x], {xis1, x}, ..] Summations sum evaluates the summations from left to right. sum[ g[i,j,k]+a delta[i,j] f[i,j,k], {i,1,k},{j,1,k},{k,1,5} ] sum[a delta[i, j] f[i, j, k] + g[i, j, k], {i, 1, k}, > {j, 1, k}, {k, 1, 5}] 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. %//.sumexpand 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}] 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. %//.sumfactor 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}] convert converts some or all of the coordinates to a format suitable for the internal function Sum. convert[%[[2]],Sum,{2}] sum[Sum[g[i, j, k], {j, 1, k}], {i, 1, k}, {k, 1, 5}] sumfactor also combines various products of sums. sum[f[i],{i,1,3,1/2}] sum[g[i],{i,2,5}]/.sumfactor 1 sum[f[iis1] g[i], {iis1, 1, 3, -}, {i, 2, 5}] 2 Manupulating non-commutative symbols Define some symbols to be noncommutative: c1/:CnumberQ[c1]=False; c2/:CnumberQ[c2]=False; c3/:CnumberQ[c3]=False; timesexpand will simplify expressions involving NonCommutativeMultiply (2 c1)**(c1+c2**a**c3)**c1//.timesexpand 2 (c1 ** c1 ** c1 + a c1 ** c2 ** c3 ** c1) Conjugate works for algebraic expressions: Conjugate[%] __ __ __ _ __ __ __ __ 2 (c1 ** c1 ** c1 + a c1 ** c3 ** c2 ** c1) 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. NormalOrder[c2**Conjugate[c3]**c1] __ :c2 ** c3: ** c1 In a similar way nonscalar symbols can be defined for Dot s1/:ScalarQ[s1]=False; s2/:ScalarQ[s2]=False; Dotexpand expands expressions involving Dot allowing for the case of non- commuting symbols (c3 s1).(c2 s2+s1 a)//.Dotexpand c3 ** ((s1 . s1) ** a + (s1 . s2) ** c2) %//.timesexpand a c3 s1 . s1 + s1 . s2 c3 ** c2 trace is also expanded by Dotexpand trace[s1.(a s2+s1)]//.Join[Dotexpand,timesexpand] trace[s1 . s1] + a trace[s1 . s2]