sumMoveIn {lazy.symbolic} | R Documentation |
Move summation to the right
Description
Move summation to the right
Usage
sumMoveIn(sexpr, frombottom = 1, all = 0, verify = 1, debug = 0)
Arguments
sexpr |
An expression containing summation |
frombottom |
= 1 to expand the bottom level summation |
all |
= 1 to move all the movable summations |
debug |
= 1 to print intermediate result |
Details
s( s( a[i,j]*b[j,k]*c[k,l], {k}) , {j}) --> s( a[i,j]*s( b[j,k]*c[k,l], {k}) , {j})
It is assumed that the scope of the subscript does NOT depend on the other subscripts.
Examples
sumMoveIn( "s( s( a[i,j]*b[j,k]*c[k,l], {k}) , {j})" )
sumMoveIn( "s( s( a[i,j]/b[j,k]*c[k,l], {k}) , {j})" )
sumMoveIn( "s( s( c[k,l]/a[i,j]/b[j,k], {k}) , {j})" )
exp="s( x * s( s( a[i,j]*b[j,k]*c[k,l], {k}) , {j}), {l})"
sumDisplay(exp) |> sumMoveIn(all=1) |> sumDisplay()
exp="s( x + s( s( a[i,j]*b[j,k]*c[k,l], {k}) - y, {j}), {l})"
sumMoveIn( exp, all=1 )
sexpr="s(A[i,s1]*s(B[s1,s2]*C[s2,j]*D[j,j],{s2,1,S2}),{s1,1,S1})"
sexpr |> print() |> sumMoveIn() |> print() |> sumMoveIn() |> print()
sumMoveIn(sexpr, all=1)
[Package lazy.symbolic version 1.0.0.20250425 ]