ExpandAll
expands out all products and integer powers in any parts of expressions.ExpandAll[transformations]
expands out products and positive integer powers in any parts of expressions and applies transformations
at each level of expand procedure.Expand polynomials anywhere inside an expression:
println ExpandAll >> '1/(1 + x)**3 + Sin[(1 + x)**3]'.t
> 1/(x**3 + 3*x**2+3*x+1) + Sin[x**3 + 3*x**2+3*x+1]
println Expand >> '1/(1 + x)**3 + Sin[(1 + x)**3]'.t
> 1/(1 + x)**3 + Sin[(1 + x)**3]'
ExpanAll[transformations]
will additionally apply transformations during expand procedure (same as Expand
):
def t = ''' 1/((g_mn + t_mn)*(g^mn + t^mn)) + + Sin[((g_mn + t_mn)*(g^mn + t^mn))]'''.t //expand all and eliminate metrics in 4 dimensions println ExpandAll[EliminateMetrics & 'd^i_i = 4'.t] >> t
> 1/(t^{mn}*t_{mn}+4+2*t_{n}^{n}) + Sin[t^{mn}*t_{mn}+4+2*t_{n}^{n}]
For examples see also Expand.