###Brief explanation###
###Brief explanation###
Brief explanation
rel = {ncm[c___, a, a, d___] :> ncm[c, i, d] , ncm[c___, b, b, b, d___] :> ncm[c,i, d] , ncm[c___, b, b, a, d___] :> ncm[c, a, b, d] , ncm[c___, b, a, d___] :> ncm[c, a, b, b, d] , ncm[a__, i] :> ncm[a] , ncm[i, a__] :> ncm[a] , ncm[a_] :> a } rel = {ncm[c___, a, a, d___] :> ncm[c, i, d] , ncm[c___, b, b, b, d___] :> ncm[c, d] , ncm[c___, b, b, a, d___] :> ncm[c, a, b, d] , ncm[c___, b, a, d___] :> ncm[c, a, b, b, d] , ncm[a__, i] :> ncm[a] , ncm[i, a__] :> ncm[a] , ncm[a_] :> a } rel = {ncm[c___, a, a, d___] :> ncm[c, i, d] , ncm[c___, b, b, b, d___] :> ncm[c,i, d] , ncm[c___, b, b, a, d___] :> ncm[c, a, b, d] , ncm[c___, b, a, d___] :> ncm[c, a, b, b, d] , ncm[a__, i] :> ncm[a] , ncm[i, a__] :> ncm[a] , ncm[a_] :> a } rel = {ncm[c___, a, a, d___] :> ncm[c, i, d] , ncm[c___, b, b, b, d___] :> ncm[c, d] , ncm[cncm[c___, b, b, a, d]d___] :> ncm[c___ncm[c, a, b, d___]d] , ncm[c___, b, a, d___] :> ncm[c, a, b, b, d] , ncm[a__, i] :> ncm[a] , ncm[i, a__] :> ncm[a] , ncm[a_] :> a } ###Brief explanation###
To answer your questions:
NonCommutativeMultiplyhas very little rules associated with it. In particular,ncm[a]doesn't evaluate, i.e. it just evaluates toncm[a]. So we have to add the rule that if we havencm[i], for instance, this will evaluate toi._isBlank. It is a pattern that will match any single expression.__isBlankSequence. It is a pattern will match any sequence of one or more expressions.___isBlankNullSequence. It will match any sequence of expressions, including theNullSequence. Meditate on the results of these three evaluations:{f[], f[a], f[a, b]} /. f[_] :> f[1]{f[], f[a], f[a, b]} /. f[__] :> f[1]{f[], f[a], f[a, b]} /. f[___] :> f[1]
rel = {ncm[c___, a, a, d___] :> ncm[c, i, d] , ncm[c___, b, b, b, d___] :> ncm[c, d] , ncm[c, b, b, a, d] :> ncm[c___, a, b, d___] , ncm[c___, b, a, d___] :> ncm[c, a, b, b, d] , ncm[a__, i] :> ncm[a] , ncm[i, a__] :> ncm[a] , ncm[a_] :> a } rel = {ncm[c___, a, a, d___] :> ncm[c, i, d] , ncm[c___, b, b, b, d___] :> ncm[c, d] , ncm[c___, b, b, a, d___] :> ncm[c, a, b, d] , ncm[c___, b, a, d___] :> ncm[c, a, b, b, d] , ncm[a__, i] :> ncm[a] , ncm[i, a__] :> ncm[a] , ncm[a_] :> a } ###Brief explanation###
To answer your questions:
NonCommutativeMultiplyhas very little rules associated with it. In particular,ncm[a]doesn't evaluate, i.e. it just evaluates toncm[a]. So we have to add the rule that if we havencm[i], for instance, this will evaluate toi._isBlank. It is a pattern that will match any single expression.__isBlankSequence. It is a pattern will match any sequence of one or more expressions.___isBlankNullSequence. It will match any sequence of expressions, including theNullSequence. Meditate on the results of these three evaluations:{f[], f[a], f[a, b]} /. f[_] :> f[1]{f[], f[a], f[a, b]} /. f[__] :> f[1]{f[], f[a], f[a, b]} /. f[___] :> f[1]