linear_expand {lazy.symbolic} | R Documentation |
Distribute functions to each of the additive terms
Description
Distribute functions to each of the additive terms
Usage
linear_expand(expr, ...)
distribute_tr(expr)
Arguments
expr |
expression as a string |
... |
names of the functions to be mapped |
Details
This function maps the functions specified by ... to each of the additive terms of the first argument as follows:
F(a+b, c) = F(a, c) + F(b, c)
... can be any function with linear property above.
For examole,
"tr", "t", "Diag", "vec", "vech", "Expand", "mat2sum", "mD"
Examples
linear_expand("F(a+b,C+D)","F")
linear_expand("F(G(a + b,Y)+G(c+d), X)","F")
linear_expand("F(G(a + b,Y)+G(c+d), X)","G")
linear_expand("F(G(a + b,Y)+G(c+d), X)","G", "F")
linear_expand("mD( tr( A%*%X+t(X)%*%B, X ) )", "mD", "tr")
[Package lazy.symbolic version 1.0.0.20250803 ]