sumExpand {lazy.symbolic} | R Documentation |
Expand (Distribute) summation
sumExpand(sexp, frombottom = 0, all = 0, debug = 0)
sexp |
An expression containing summation |
frombottom |
= 1 to expand the bottom level summation |
all |
= 1 to expand all the summations |
debug |
= 1 to print intermediate result |
s( a + b, {scope} ) -> s( a, {scope} ) + s( b, {scope} )
sumExpand("s( a + b, {scope} ) ")
exp <- "s(a[i],{i})+s( b*( s(c[i,j],{j}) - s(d[i,j],{j}) ), {i} )"
sumExpand( exp)
exp <- "s( a[i]+b[i] - s( c[ij]-d[ij], {j} ), {i})"
sumExpand( exp, frombottom=1)
sumExpand( exp )
sumExpand( exp, all=1 )