4949% ITP-UU-06/56\\
5050hep-th/0701238\\
515125 January 2007\\
52- 11 June 2016 (updated for v2)
52+ 8 August 2017 (updated for v2)
5353\end {flushright }
5454\vskip 7ex
5555
8888\begin {minipage }{0.95\textwidth }
8989\noindent {\smaller\smaller This paper originally appeared in 2007. It
9090 has been updated to reflect the syntax changes introduced with
91- Cadabra~2.0 (released in 2016), but is otherwise essentially
91+ Cadabra~2.0 (first released in 2016), but is otherwise essentially
9292 unchanged. A more in-depth discussion of the changes of the 2.x
9393 series will appear in an upcoming paper. The software itself,
9494 including source code, can be obtained from the web site
@@ -565,18 +565,18 @@ \subsection{A Riemann tensor polynomial example}
565565canonical form with respect to mono-term symmetries,
566566\end {cdbcom }
567567\begin {cdbcont }
568- @ distribute!( % ): @prodrule!(%):
569- @ distribute!( % ): @prodrule!(%):
568+ distribute(_); product_rule(_);
569+ distribute(_); product_rule(_);
570570
571- @prodsort!( % ): @ canonicalise!(%): @rename_dummies!(%):
572- @collect_terms!( % ):
571+ sort_product(_); canonicalise(_);
572+ rename_dummies(_);
573573\end {cdbcont }
574574\begin {cdbcom }
575575Because the identity which we intend to prove is only supposed to hold
576576on Einstein spaces, we set the divergence of the Weyl tensor to zero,
577577\end {cdbcom }
578578\begin {cdbcont }
579- @ substitute!( % )( \nabla_{i}{C_{k i l m}} -> 0 , \nabla_{i}{C_{k m l i}} -> 0 );
579+ substitute(_, $ \nabla _{i}{C_{k i l m}} -> 0 , \nabla _{i}{C_{k m l i}} -> 0 $ );
580580\end {cdbcont }
581581\begin {cdbout }
582582\begin {aligned }
@@ -603,9 +603,7 @@ \subsection{A Riemann tensor polynomial example}
603603expanding all tensors using their Young projectors, this becomes manifest,
604604\end {cdbcom }
605605\begin {cdbcont }
606- @young_project_product!(% ):
607- @sumflatten!(% ):
608- @collect_terms!(% );
606+ young_project_product(_);
609607\end {cdbcont }
610608\begin {cdbout }
6116090;
@@ -641,8 +639,8 @@ \subsection{Index ranges and subspaces, Kaluza-Klein gravity}
641639{m, n, p}::Indices(subspace1).
642640{a, b, c}::Indices(subspace2).
643641
644- A_{M N} B_{N P};
645- @ split_index!( % ){ M, m, a} ;
642+ ex:= A_{M N} B_{N P};
643+ split_index(_, $ M, m, a$ ) ;
646644\end {cdbin }
647645\begin {cdbout }
648646A_{M m} \, B_{m P} + A_{M a}\, B_{a P}\, ;
@@ -707,9 +705,10 @@ \subsection{Index ranges and subspaces, Kaluza-Klein gravity}
707705We will want to expand the Riemann tensor in terms of the metric. The
708706following two substitution rules do the conversion from Riemann tensor
709707to Christoffel symbol and from Christoffel symbol to
710- metric.\footnote {A library with common substitution rules like these
711- is in preparation.} Index
712- patterns like \verb |\lambda? | match both four- and three-dimensional indices.
708+ metric.\footnote {Cadabra 2.x contains a growing library of packages
709+ with expressions of this type, but we will here not rely on that
710+ library facility.} Index patterns like \verb |\lambda? | match both four- and
711+ three-dimensional indices.
713712\end {cdbcom }
714713\begin {cdbcont }
715714RtoG:= R^{\lambda ?}_{\mu ?\nu ?\kappa ?} ->
@@ -730,12 +729,12 @@ \subsection{Index ranges and subspaces, Kaluza-Klein gravity}
730729\end {cdbcom }
731730\begin {cdbcont }
732731todo:= g_{m1 m} R^{m1}_{4 n 4} + g_{4 m} R^{4}_{4 n 4};
733- @ substitute!( % )( @( RtoG) );
734- @ substitute!( % )( @( Gtog) );
735- @ distribute!( % );
736- @prodrule!( % );
737- @ distribute!( % );
738- @prodsort!( % );
732+ substitute(_, RtoG)
733+ substitute(_, Gtog)
734+ distribute(_)
735+ product_rule(_)
736+ distribute(_)
737+ sort_product(_)
739738\end {cdbcont }
740739\begin {cdbcom }
741740We now split the $ \mu $ index into a $ m$ part and the remaining $ 4 $
@@ -744,55 +743,55 @@ \subsection{Index ranges and subspaces, Kaluza-Klein gravity}
744743field and write the expression in canonical form,
745744\end {cdbcom }
746745\begin {cdbcont }
747- @split_index!!(% ){\mu,m1,4};
748- @canonicalise!(% ):
749- @substitute!(% )( \partial_{4}{A??} -> 0 );
750- @substitute!(% )( \partial_{4 m?}{A??} -> 0 );
746+ split_index(_, $ \mu , m1 , 4 $ , repeat=True)
747+ substitute(_, $ \partial _{4}{A??} -> 0 $ , repeat=True)
748+ substitute(_, $ \partial _{4 m?}{A??} -> 0 $ , repeat=True)
749+ substitute(_, $ \partial _{m? 4}{A??} -> 0 $ , repeat=True)
750+ canonicalise(_);
751751\end {cdbcont }
752752\begin {cdbcom }
753753In the next step, we insert the metric ansatz~\eqref {e:KKansatz } and
754754simplify the result as much as possible.
755755\end {cdbcom }
756756\begin {cdbcont }
757- @substitute!(% )( g_{4 4} -> \phi ):
758- @substitute!(% )( g_{4 m} -> \phi A_{m} ):
759- @substitute!(% )( g_{m n} -> \phi**{-1} h_{m n} + \phi A_{m} A_{n} );
760- @substitute!(% )( g^{4 4} -> \phi**{-1} + \phi A_{m} h^{m n} A_{n} ):
761- @substitute!(% )( g^{4 m} -> - \phi h^{m n} A_{n} ):
762- @substitute!(% )( g^{m n} -> \phi h^{m n} ):
763- @distribute!(% ):
764- @prodrule!(% ):
765- @distribute!(% ):
766- @prodrule!(% );
767- @distribute!(% );
768- @canonicalise!(% ):
769- @substitute!!(% )( h_{m1 m2} h^{m3 m2} -> \delta_{m1}^{m3} );
770- @eliminate_kr!(% ):
757+ substitute(_, $ g_{4 4} -> \phi $ )
758+ substitute(_, $ g_{m 4} -> \phi A_{m}$ )
759+ substitute(_, $ g_{4 m} -> \phi A_{m}$ )
760+ substitute(_, $ g_{m n} -> \phi **{-1} h_{m n} + \phi A_{m} A_{n}$ )
761+ substitute(_, $ g^{4 4} -> \phi **{-1} + \phi A_{m} h^{m n} A_{n}$ )
762+ substitute(_, $ g^{m 4} -> - \phi h^{m n} A_{n}$ )
763+ substitute(_, $ g^{4 m} -> - \phi h^{m n} A_{n}$ )
764+ substitute(_, $ g^{m n} -> \phi h^{m n}$ );
771765\end {cdbcont }
772766\begin {cdbcom }
773767Some derivatives have to be rewritten to a canonical form,
774768\end {cdbcom }
775769\begin {cdbcont }
776- @substitute!(% )( \partial_{m}{\phi**{-1}} -> -\phi**{-2} \partial_{m}{\phi} ):
777- @collect_factors!(% ):
778- @prodsort!(% ):
779- @substitute!(% )( \partial_{p}{h^{n m}} h_{q m} -> - \partial_{p}{h_{q m}} h^{n m} );
780- @canonicalise!(% ):
781- @substitute!(% )( h_{m1 m2} h^{m3 m2} -> \delta_{m1}^{m3} );
782- @eliminate_kr!(% );
770+ converge(todo):
771+ distribute(_)
772+ product_rule(_)
773+ canonicalise(_)
774+ \end {cdbcont }
775+ \begin {cdbcont }
776+ substitute(_, $ \partial _{p}{h^{n m}} h_{q m} -> - \partial _{p}{h_{q m}} h^{n m}$ )
777+ collect_factors(_)
778+ sort_product(_)
779+ converge(todo):
780+ substitute(_, $ h_{m1 m2} h^{m3 m2} -> \delta _{m1}^{m3}$ , repeat=True )
781+ eliminate_kronecker(_)
782+ canonicalise(_)
783+ ;
783784\end {cdbcont }
784785\begin {cdbcom }
785786Finally, we replace the derivative of the gauge field with the field
786787strength,
787788\end {cdbcom }
788789\begin {cdbcont }
789- @substitute!(% )( \partial_{n}{A_{m}} -> 1/2*\partial_{n}{A_{m}} + 1/2*F_{n m}
790- + 1/2*\partial _{m}{A_{n}} ):
791- @distribute!(% ):
792- @prodsort!(% ):
793- @canonicalise!(% ):
794- @rename_dummies!(% ):
795- @collect_terms!(% );
790+ substitute(_, $ \partial _{n}{A_{m}} -> 1 /2 *\partial _{n}{A_{m}} + 1 /2 *F_{n m} + 1 /2 *\partial _{m}{A_{n}}$ )
791+ distribute(_)
792+ sort_product(_)
793+ canonicalise(_)
794+ rename_dummies(_);
796795\end {cdbcont }
797796\begin {cdbout }
798797\begin {aligned }
@@ -835,16 +834,8 @@ \subsection{Simple gamma matrix algebra}
835834\Gamma _{k m} \Gamma _{m s}$ in arbitrary dimensions in terms of the
836835irreducible~$ \Gamma _{kl}$ and $ \delta _{kl}$ components.
837836\toprule
838- \begin {cdbin }
839- ::PostDefaultRules( @@prodsort!(% ), @@eliminate_kr!(%),
840- @@canonicalise!(% ), @@collect_terms!(%) ).
841- \end {cdbin }
842837\begin {cdbcom }
843- This single line adds some default simplification rules to the system,
844- so that we do not have to type these by hand at every stage of the
845- calculation.
846-
847- We now declare the vector indices, their range, and the symbols used for
838+ We first declare the vector indices, their range, and the symbols used for
848839gamma matrices and Kronecker deltas.
849840\end {cdbcom }
850841\begin {cdbcont }
@@ -859,35 +850,50 @@ \subsection{Simple gamma matrix algebra}
859850suppressed. The notation \verb |_{#} | denotes the presence of an
860851arbitrary number of indices.
861852
862- Next follows the actual calculation.
853+ It is useful to let Cadabra do a bit more simplification at every step
854+ (more than the default of simply collecting equal terms). This can be
855+ achieved by re-defining the \verb |post_process | function, which gets
856+ called after every step of the computation.
857+ \end {cdbcom }
858+ \begin {cdbin }
859+ def post_process(ex):
860+ sort_product(ex)
861+ eliminate_kronecker(ex)
862+ canonicalise(ex)
863+ collect_terms(ex)
864+ \end {cdbin }
865+ \begin {cdbcom }
866+ This sorts the product, eliminate Kronecker delta's, writes indices in
867+ canonical order and then finally collects equal terms.
868+
869+ Next follows the actual computation. We write down the gamma matrix
870+ product and join gamma matrices three times,
863871\end {cdbcom }
864872\begin {cdbcont }
865- \Gamma _{s r} \Gamma _{r l} \Gamma _{k m} \Gamma _{m s}:
866- @join!(% ){expand}:
867- @join!(% ){expand};
873+ ex:= \Gamma _{s r} \Gamma _{r l} \Gamma _{k m} \Gamma _{m s};
874+ for i in range(3):
875+ join_gamma(_)
876+ distribute(_)
868877\end {cdbcont }
869878\begin {cdbout }
870879\label {e:gam1 }
871- (-1) ((2 \Gamma _{l r} - \Gamma _{l r} d + \delta _{l r} d - \delta _{l r}) (2 \Gamma _{k r} - \Gamma _{k r} d + \delta _{k r} - \delta _{k r} d));
880+ -18 \Gamma _{kl} d + 8 \Gamma _{kl} d d + 12 \Gamma _{kl} - 3\delta _{kl}
881+ + 6 \delta _{kl} d - 4 \delta _{kl} d d - \Gamma _{k l} d d d +
882+ \delta _{kl} d d d
872883\end {cdbout }
873884\begin {cdbcont }
874- @distribute!(% );
875- @join!(% ){expand};
876- @distribute!(% );
877- @factorise!(% ){d};
878- @collect_factors!(% );
885+ factor_in(_, $ d$ )
886+ collect_factors(_)
879887\end {cdbcont }
880888\begin {cdbout }
881- \Gamma _{k l} (12 - 18 d + 8 d^2 - d^3) + \delta _{k l} ( - 3 + 6 d - 4 d^2 + d^3);
889+ \Gamma _{k l} (- 18 d + 8 d^2 + 12 - d^3) + \delta _{k l} ( - 3 + 6 d - 4 d^2 + d^3);
882890\end {cdbout }
883891\botrule
884- The key ingredient here is the \verb |@join | command , which
892+ The key ingredient here is the \verb |join_gamma | algorithm , which
885893takes two adjacent gamma matrices and expands their product in terms of
886894a basis of fully antisymmetrised gamma matrices. In the step
887- before~\eqref {e:gam1 } the two commands join the 1st and 2nd gamma
888- matrix, as well as the 3rd and 4th. The product is then expanded out
889- and one final gamma join operation is performed. The last two lines
890- combine all the $ d$ -dependence in overall factors.
895+ before~\eqref {e:gam1 } the Python loop performs such a join three times
896+ and expands out the resulting product.
891897
892898In the example above, the spinor indices on the gamma matrices were
893899suppressed. The \verb |GammaMatrix | property has turned the gamma
@@ -903,14 +909,14 @@ \subsection{Simple gamma matrix algebra}
903909{a,b,c,d#}::Indices(spinor).
904910\Gamma _{#}::GammaMatrix(metric=\delta ).
905911(\Gamma _{m n})_{a b} (\Gamma _{n p})_{b c};
906- @ combine!( % );
912+ combine(_ );
907913\end {cdbin }
908914\begin {cdbout }
909915(\Gamma _{m n}\, \Gamma _{n p})_{a c};
910916\end {cdbout }
911917\begin {cdbcont }
912- @join!( % ){expand}:
913- @ canonicalise!( % );
918+ join_gamma(_)
919+ canonicalise(_ );
914920\end {cdbcont }
915921\begin {cdbout }
916922 (\Gamma _{m p} \delta _{n n} - \Gamma _{m n} \delta _{n p} + \Gamma _{p n} \delta _{m n}
@@ -924,8 +930,8 @@ \subsection{Simple gamma matrix algebra}
924930indices:
925931\toprule
926932\begin {cdbcont }
927- @ distribute!( % ):
928- @ expand!( % );
933+ distribute(_)
934+ expand(_ );
929935\end {cdbcont }
930936\begin {cdbout }
931937 (\Gamma _{m p})_{a c} \delta _{n n} - (\Gamma _{m n})_{a c} \delta _{n p}
0 commit comments