{ "cells" : [ { "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_origin" : "client", "cell_type" : "latex_view", "source" : "\\algorithm{substitute}{Generic substitution algorithm.}\n\n Generic substitution algorithm.\nTakes a rule or a set of rules according to which an expression\nshould be modified. If more than one rule is given, it tries each rule\nin turn, until the first working one is encountered, after which it\ncontinues with the next node." } ], "hidden" : true, "source" : "\\algorithm{substitute}{Generic substitution algorithm.}\n\n Generic substitution algorithm.\nTakes a rule or a set of rules according to which an expression\nshould be modified. If more than one rule is given, it tries each rule\nin turn, until the first working one is encountered, after which it\ncontinues with the next node." }, { "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}G_{\\mu \\nu \\rho}+F_{\\mu \\nu \\rho}\\end{dmath*}" }, { "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}G_{\\mu \\nu \\rho}+A_{\\mu \\nu} B_{\\rho}\\end{dmath*}" } ], "source" : "ex:=G_{\\mu \\nu \\rho} + F_{\\mu \\nu \\rho};\nsubstitute(_, $F_{\\mu \\nu \\rho} -> A_{\\mu \\nu} B_{\\rho}$ );" }, { "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}A_{\\mu \\nu} B_{\\nu \\rho} C_{\\rho \\sigma}\\end{dmath*}" }, { "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}D_{\\mu \\sigma} B_{\\nu \\rho}\\end{dmath*}" } ], "source" : "ex:= A_{\\mu \\nu} B_{\\nu \\rho} C_{\\rho \\sigma};\nsubstitute(_, $A_{m n} C_{p q} -> D_{m q}$ );" }, { "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_origin" : "client", "cell_type" : "latex_view", "source" : "This command takes full care of dummy index relabelling, as the\nfollowing example shows:" } ], "hidden" : true, "source" : "This command takes full care of dummy index relabelling, as the\nfollowing example shows:" }, { "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}a_{m} b_{n}\\end{dmath*}" } ], "source" : "{m,n,q,r,s,t,u}::Indices(vector).\nex:= a_{m} b_{n};" }, { "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}c_{q r} d_{q r m} b_{n}\\end{dmath*}" } ], "source" : "substitute(_, $a_{q} -> c_{m n} d_{m n q}$ );" }, { "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_origin" : "client", "cell_type" : "latex_view", "source" : "By postfixing a name with a question mark, it becomes a pattern. You do not need this for indices (as the examples\nabove show) but it is necessary for other types of function arguments." } ], "hidden" : true, "source" : "By postfixing a name with a question mark, it becomes a pattern. You do not need this for indices (as the examples\nabove show) but it is necessary for other types of function arguments." }, { "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\sin{x}^{2}+3+\\cos{x}^{2}\\end{dmath*}" }, { "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}4\\end{dmath*}" } ], "source" : "ex:= \\sin{ x }**2 + 3 + \\cos{ x }**2;\nsubstitute(ex, $\\sin{A?}**2 + \\cos{A?}**2 = 1$);" }, { "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_origin" : "client", "cell_type" : "latex_view", "source" : "Substitute can match sub-products and sub-sums, and you do not have to specify terms or factors in the order in which they appear," } ], "hidden" : true, "source" : "Substitute can match sub-products and sub-sums, and you do not have to specify terms or factors in the order in which they appear," }, { "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_origin" : "server", "cell_type" : "latex_view", "cells" : [ { "cell_origin" : "server", "cell_type" : "input_form", "source" : "A + B + C + D" } ], "source" : "\\begin{dmath*}{}A+B+C+D\\end{dmath*}" }, { "cell_origin" : "server", "cell_type" : "latex_view", "cells" : [ { "cell_origin" : "server", "cell_type" : "input_form", "source" : "Q + B + D" } ], "source" : "\\begin{dmath*}{}Q+B+D\\end{dmath*}" } ], "source" : "ex:= A + B + C + D;\nsubstitute(_, $A+C=Q$);" }, { "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_origin" : "server", "cell_type" : "latex_view", "cells" : [ { "cell_origin" : "server", "cell_type" : "input_form", "source" : "A B C D" } ], "source" : "\\begin{dmath*}{}A B C D\\end{dmath*}" }, { "cell_origin" : "server", "cell_type" : "latex_view", "cells" : [ { "cell_origin" : "server", "cell_type" : "input_form", "source" : "A Q C" } ], "source" : "\\begin{dmath*}{}A Q C\\end{dmath*}" } ], "source" : "ex:= A B C D;\nsubstitute(_, $B D = Q$);" }, { "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_origin" : "client", "cell_type" : "latex_view", "source" : "However, you can request that the match is for the full sum or product, " } ], "source" : "However, you can request that the match is for the full sum or product, " }, { "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_origin" : "server", "cell_type" : "latex_view", "cells" : [ { "cell_origin" : "server", "cell_type" : "input_form", "source" : "A B C D + A B C D E F" } ], "source" : "\\begin{dmath*}{}A B C D+A B C D E F\\end{dmath*}" }, { "cell_origin" : "server", "cell_type" : "latex_view", "cells" : [ { "cell_origin" : "server", "cell_type" : "input_form", "source" : "1 + A B C D E F" } ], "source" : "\\begin{dmath*}{}1+A B C D E F\\end{dmath*}" } ], "source" : "ex:= A B C D + A B C D E F;\nsubstitute(_, $A B C D = 1$, partial=False);" }, { "cell_origin" : "client", "cell_type" : "latex", "cells" : [ { "cell_origin" : "client", "cell_type" : "latex_view", "source" : "It will respect non-commuting objects and will not match if that would require moving non-commuting objects through each other," } ], "hidden" : true, "source" : "It will respect non-commuting objects and will not match if that would require moving non-commuting objects through each other," }, { "cell_origin" : "client", "cell_type" : "input", "cells" : [ { "cell_origin" : "server", "cell_type" : "latex_view", "source" : "\\begin{dmath*}{}\\text{Attached property NonCommuting to~}\\left[Q,~\\discretionary{}{}{} R,~\\discretionary{}{}{} S,~\\discretionary{}{}{} T\\right].\\end{dmath*}" }, { "cell_origin" : "server", "cell_type" : "latex_view", "cells" : [ { "cell_origin" : "server", "cell_type" : "input_form", "source" : "Q R S T" } ], "source" : "\\begin{dmath*}{}Q R S T\\end{dmath*}" }, { "cell_origin" : "server", "cell_type" : "latex_view", "cells" : [ { "cell_origin" : "server", "cell_type" : "input_form", "source" : "Q R S T" } ], "source" : "\\begin{dmath*}{}Q R S T\\end{dmath*}" } ], "source" : "{Q,R,S,T}::NonCommuting;\nex:= Q R S T;\nsubstitute(_, $S Q = 1$);" }, { "cell_origin" : "client", "cell_type" : "input", "source" : "" } ], "description" : "Cadabra JSON notebook format", "version" : 1 }