{ "cell_id" : 5716356280111729715, "cells" : [ { "cell_id" : 7757173625391423646, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 11255716305935146302, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "\\section*{Cadabra quick start}\n\nThis is a quick start introduction to Cadabra. For more in-depth\ndiscussion of its features, consult the various\n\\href{http://cadabra.science/tutorials.html}{tutorials}.\n\nAfter installation, Cadabra can be started with \\verb|cadabra2-gtk| from the command line, \nor by picking it from the `Education' menu.\n\n\\subsection*{Bosonic basics}\n\nBefore discussing actual calculations, let us start with a few words\nconcerning notation. This discussion can be short because \nmathematical expressions are entered\nessentially as one would enter them in TeX (with a few restrictions\nto avoid ambiguities, which we will discuss as we go along). In order\nto manipulate expressions, Cadabra often needs to know a bit more about\nproperties of tensors or other symbols. Such properties are entered\nusing the `\\verb|::|' symbol. A simple example is the declaration of\nindex sets, useful for automatic dummy index relabelling. An example\nwill clarify this," } ], "hidden" : true, "source" : "\\section*{Cadabra quick start}\n\nThis is a quick start introduction to Cadabra. For more in-depth\ndiscussion of its features, consult the various\n\\href{http://cadabra.science/tutorials.html}{tutorials}.\n\nAfter installation, Cadabra can be started with \\verb|cadabra2-gtk| from the command line, \nor by picking it from the `Education' menu.\n\n\\subsection*{Bosonic basics}\n\nBefore discussing actual calculations, let us start with a few words\nconcerning notation. This discussion can be short because \nmathematical expressions are entered\nessentially as one would enter them in TeX (with a few restrictions\nto avoid ambiguities, which we will discuss as we go along). In order\nto manipulate expressions, Cadabra often needs to know a bit more about\nproperties of tensors or other symbols. Such properties are entered\nusing the `\\verb|::|' symbol. A simple example is the declaration of\nindex sets, useful for automatic dummy index relabelling. An example\nwill clarify this," }, { "cell_id" : 103293113963716287, "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_id" : 9223372036854775809, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\text{Attached property Indices(position=free) to~}\\left[a,~\\discretionary{}{}{} b,~\\discretionary{}{}{} c,~\\discretionary{}{}{} d\\right].\\end{dmath*}" }, { "cell_id" : 9223372036854775810, "cell_origin" : "server", "cell_type" : "latex_view", "cells" : [ { "cell_id" : 9223372036854775811, "cell_origin" : "server", "cell_type" : "input_form", "source" : "A_{a b} B_{b c}" } ], "source" : "\\begin{dmath*}{}A_{a b} B_{b c}\\end{dmath*}" } ], "source" : "{ a, b, c, d }::Indices;\nex:= A_{a b} B_{b c};" }, { "cell_id" : 6206707828745205786, "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_id" : 9223372036854775813, "cell_origin" : "server", "cell_type" : "latex_view", "cells" : [ { "cell_id" : 9223372036854775814, "cell_origin" : "server", "cell_type" : "input_form", "source" : "A_{a b} C_{b c d} D_{d}" } ], "source" : "\\begin{dmath*}{}A_{a b} C_{b c d} D_{d}\\end{dmath*}" } ], "source" : "substitute(_, $B_{a b} -> C_{a b c} D_{c}$ );" }, { "cell_id" : 7045409746205840896, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 3700100225770046834, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "The automatic index relabelling which has taken place in this\nsubstitute command was clearly only possible because of the property\ndeclaration in the first line. Note how the substitute command has\nalso figured out that \\verb|B_{a b}| on the left-hand side is\nequivalent to \\verb|B_{b c}|, without any explicit wildcards or\npatterns. We will see more of this type of field-theory motivated\nlogic throughout the paper." } ], "hidden" : true, "source" : "The automatic index relabelling which has taken place in this\nsubstitute command was clearly only possible because of the property\ndeclaration in the first line. Note how the substitute command has\nalso figured out that \\verb|B_{a b}| on the left-hand side is\nequivalent to \\verb|B_{b c}|, without any explicit wildcards or\npatterns. We will see more of this type of field-theory motivated\nlogic throughout the paper." }, { "cell_id" : 3939233137557893239, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 8995867847458487530, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "Indices can be simple letters, as in the example above, but it is also\nperfectly possible to put accents on them. This can be useful for\ne.g.~notations involving chiral spinors. The following example\nillustrates the use of accents on indices." } ], "hidden" : true, "source" : "Indices can be simple letters, as in the example above, but it is also\nperfectly possible to put accents on them. This can be useful for\ne.g.~notations involving chiral spinors. The following example\nillustrates the use of accents on indices." }, { "cell_id" : 18272292102993358173, "cell_origin" : "client", "cell_type" : "input", "source" : "\\dot{#}::Accent;\nA_{\\dot{a} \\dot{b}}::AntiSymmetric;\nex:= A_{\\dot{b} \\dot{a}};" }, { "cell_id" : 8726009276796452632, "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_id" : 10191742109424542640, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}-A_{\\dot{a} \\dot{b}}\\end{dmath*}" } ], "source" : "canonicalise(_);" }, { "cell_id" : 17301188597788460065, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 12380391792656256536, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "Here we also see a second usage of property declarations: the\nconstruction in the first line declares that the $A_{\\dot{a} \\dot{b}}$\ntensor is antisymmetric in its indices. The canonicalise command\nsubsequently writes the input in a canonical form, which in this\ntrivial example simply means that the indices gets sorted in\nalphabetical order. Continuing the example above, one can also use\nsubscripts or superscripts on indices, as in the example below." } ], "hidden" : true, "source" : "Here we also see a second usage of property declarations: the\nconstruction in the first line declares that the $A_{\\dot{a} \\dot{b}}$\ntensor is antisymmetric in its indices. The canonicalise command\nsubsequently writes the input in a canonical form, which in this\ntrivial example simply means that the indices gets sorted in\nalphabetical order. Continuing the example above, one can also use\nsubscripts or superscripts on indices, as in the example below." }, { "cell_id" : 11192134437285109843, "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_id" : 6608670350216599249, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\text{Attached property Indices(position=free) to~}\\left\\{a_{1}, \\linebreak[0] a_{2}, \\linebreak[0] a_{3}, \\linebreak[0] a_{4}\\right\\}.\\end{dmath*}" }, { "cell_id" : 11894732657201129903, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}V_{a_{1}} W_{a_{1}}\\end{dmath*}" }, { "cell_id" : 193345049390931887, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}M_{a_{1} a} N_{a} W_{a_{1}}\\end{dmath*}" } ], "source" : "{ a_{1}, a_{2}, a_{3}, a_{4} }::Indices(vector);\nex:= V_{a_{1}} W_{a_{1}};\nsubstitute(_, $V_{a_{2}} -> M_{a_{2} a_{1}} N_{a_{1}}$ );" }, { "cell_id" : 14955216728724290107, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 4273410186771757488, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "The input format is a mixture of Cadabra's own LaTeX-like language for\nthe description of mathematical expressions, and Python. The\nunderscore symbol `\\verb|_|' always refers to the last-used expression." } ], "hidden" : true, "source" : "The input format is a mixture of Cadabra's own LaTeX-like language for\nthe description of mathematical expressions, and Python. The\nunderscore symbol `\\verb|_|' always refers to the last-used expression." }, { "cell_id" : 10649798021102149437, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 7873409660672401713, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "A guiding principle in Cadabra is that nothing ever has to be declared\nunless this is absolutely needed. This is in contrast to many other\nsystems, where for instance one has to declare manifolds and index\nsets and so on before one can even enter a tensor expression. This\nmakes code hard to read, but more importantly, such additional\ndeclarations are hard to remember. As an example of how Cadabra works,\none can e.g.~input tensor expressions and perform substitution on them,\nwithout ever declaring the symbols used for indices. Only when the\nprogram needs to generate new dummy indices does one need to declare\nindex sets, so that dummy indices can be taken out of the right\nset. The general guideline is that ``one only\nneeds to tell the program about the meaning of symbols when this is\nactually required to do the manipulation correctly''.\n" } ], "hidden" : true, "source" : "A guiding principle in Cadabra is that nothing ever has to be declared\nunless this is absolutely needed. This is in contrast to many other\nsystems, where for instance one has to declare manifolds and index\nsets and so on before one can even enter a tensor expression. This\nmakes code hard to read, but more importantly, such additional\ndeclarations are hard to remember. As an example of how Cadabra works,\none can e.g.~input tensor expressions and perform substitution on them,\nwithout ever declaring the symbols used for indices. Only when the\nprogram needs to generate new dummy indices does one need to declare\nindex sets, so that dummy indices can be taken out of the right\nset. The general guideline is that ``one only\nneeds to tell the program about the meaning of symbols when this is\nactually required to do the manipulation correctly''.\n" }, { "cell_id" : 4928880447376698898, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 7710784338868361327, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "In order to declare symmetries of tensors, it is possible to use\nsimple shorthands like the \\prop{AntiSymmetric} in the example above. \nMore generally, symmetries can be declared using a generic Young\ntableau notation. An object with the symmetries of a Riemann tensor,\nfor example, can be declared as in the following example." } ], "hidden" : true, "source" : "In order to declare symmetries of tensors, it is possible to use\nsimple shorthands like the \\prop{AntiSymmetric} in the example above. \nMore generally, symmetries can be declared using a generic Young\ntableau notation. An object with the symmetries of a Riemann tensor,\nfor example, can be declared as in the following example." }, { "cell_id" : 11042877764109095134, "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_id" : 1402957615224784829, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}R_{a b c d} R_{d c a b}\\end{dmath*}" }, { "cell_id" : 8694570044256099378, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}-R_{a b c d} R_{a b c d}\\end{dmath*}" } ], "source" : "R_{a b c d}::TableauSymmetry(shape={2,2}, indices={0,2,1,3}).\nex:=R_{a b c d} R_{d c a b};\ncanonicalise(_);" }, { "cell_id" : 17179130787021300618, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 19485351281891507, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "The first line indicates that the tensor has the symmetries of the\n$2\\times 2$ Young tableau. The \\algo{canonicalise} command writes\nthe input in canonical form with respect to mono-term symmetries\n(anti-symmetry in the two index pairs and symmetry under pair\nexchange). The Ricci symmetry is also encoded in the Young tableau and\nwill be discussed later. Many tensor symmetries have shorthand\nnotations, so one often does not have spell out the tableau (e.g.~\\prop{RiemannTensor} or \\prop{SatisfiesBianchi}).\n" } ], "hidden" : true, "source" : "The first line indicates that the tensor has the symmetries of the\n$2\\times 2$ Young tableau. The \\algo{canonicalise} command writes\nthe input in canonical form with respect to mono-term symmetries\n(anti-symmetry in the two index pairs and symmetry under pair\nexchange). The Ricci symmetry is also encoded in the Young tableau and\nwill be discussed later. Many tensor symmetries have shorthand\nnotations, so one often does not have spell out the tableau (e.g.~\\prop{RiemannTensor} or \\prop{SatisfiesBianchi}).\n" }, { "cell_id" : 13295413574068657490, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 18067534547552251550, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "\\subsection*{Derivatives and dependencies}\n\nThere are relatively few surprises when it comes to derivatives.\nIt is possible to write derivatives with respect to coordinates,\ni.e.~write~$\\partial_x$ where~$x$ is a coordinate, but\nit is also possible to use indices, as in~$\\partial_i$ with $i$ being\na vector index. It is also possible to make objects implicitly\ndependent on a derivative operator, so that one can write~$\\partial\nA$ without an explicit specification of the coordinate which is\ninvolved here. " } ], "hidden" : true, "source" : "\\subsection*{Derivatives and dependencies}\n\nThere are relatively few surprises when it comes to derivatives.\nIt is possible to write derivatives with respect to coordinates,\ni.e.~write~$\\partial_x$ where~$x$ is a coordinate, but\nit is also possible to use indices, as in~$\\partial_i$ with $i$ being\na vector index. It is also possible to make objects implicitly\ndependent on a derivative operator, so that one can write~$\\partial\nA$ without an explicit specification of the coordinate which is\ninvolved here. " }, { "cell_id" : 15605589921123687497, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 508266178189537151, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "In order to make this possible, however, derivative objects have to be\ndeclared just like indices, otherwise the system does not know which\nsymbol ($\\partial$, $D$, $d$, $\\nabla$, \\ldots) one wants to use for\nthem. Implicit dependencies of objects on coordinates associated to\nderivatives is indicated through a \\prop{Depends} property. Here is an\nexample to illustrate all this:" } ], "hidden" : true, "source" : "In order to make this possible, however, derivative objects have to be\ndeclared just like indices, otherwise the system does not know which\nsymbol ($\\partial$, $D$, $d$, $\\nabla$, \\ldots) one wants to use for\nthem. Implicit dependencies of objects on coordinates associated to\nderivatives is indicated through a \\prop{Depends} property. Here is an\nexample to illustrate all this:" }, { "cell_id" : 11942606738048787455, "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_id" : 6117908760502214353, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\text{Attached property Indices(position=free) to~}\\left\\{m, \\linebreak[0] n, \\linebreak[0] p, \\linebreak[0] q, \\linebreak[0] r\\right\\}.\\end{dmath*}" }, { "cell_id" : 1202969890068169255, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\text{Attached property Derivative to~}\\nabla{\\#}.\\end{dmath*}" }, { "cell_id" : 16962655093109485107, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\text{Attached property PartialDerivative to~}\\partial{\\#}.\\end{dmath*}" }, { "cell_id" : 11000508826222965474, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\text{Attached property AntiSymmetric to~}A_{m n}.\\end{dmath*}" }, { "cell_id" : 10050122667762509553, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\text{Attached property Depends to~}V_{m}.\\end{dmath*}" }, { "cell_id" : 6920800992316428716, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\partial_{m p}\\left(A_{q r} V_{n}\\right) A^{p m}\\end{dmath*}" } ], "source" : "{m,n,p,q,r}::Indices(position=free);\n\\nabla{#}::Derivative;\n\\partial{#}::PartialDerivative;\nA_{m n}::AntiSymmetric;\nV_{m}::Depends(\\nabla{#});\n\nex:= \\partial_{m p}( A_{q r} V_{n} ) A^{p m};" }, { "cell_id" : 3136840608177541058, "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_id" : 4897756282813376460, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}0\\end{dmath*}" } ], "source" : "canonicalise(_);" }, { "cell_id" : 10994095467781940960, "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_id" : 15342546519721877711, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\nabla_{m p}\\left(A_{q r} V_{n}\\right) A^{p m}\\end{dmath*}" }, { "cell_id" : 9104149497242645041, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}-\\nabla^{m p}\\left(A_{q r} V_{n}\\right) A_{m p}\\end{dmath*}" } ], "source" : "ex:=\\nabla_{m p}( A_{q r} V_{n} ) A^{p m};\ncanonicalise(_);" }, { "cell_id" : 17765294794886716645, "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_id" : 18213103545406437598, "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}-A_{q r} \\nabla^{m p}{V_{n}} A_{m p}\\end{dmath*}" } ], "source" : "unwrap(_);" }, { "cell_id" : 16161961747209770793, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 910392170269658202, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "Note how the symmetry of a double partial derivative has automatically\nbeen taken into account (it\nis part of the \\prop{PartialDerivative} property). This is called\n``property inheritance''." } ], "hidden" : true, "source" : "Note how the symmetry of a double partial derivative has automatically\nbeen taken into account (it\nis part of the \\prop{PartialDerivative} property). This is called\n``property inheritance''." }, { "cell_id" : 3935600940570551980, "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_id" : 12617856564588563850, "cell_origin" : "client", "cell_type" : "latex_view", "source" : "\\section*{More to follow ...}" } ], "hidden" : true, "source" : "\\section*{More to follow ...}" }, { "cell_id" : 5559244724204550377, "cell_origin" : "client", "cell_type" : "input", "source" : "" } ], "description" : "Cadabra JSON notebook format", "version" : 1 }