sumEval {lazy.symbolic} | R Documentation |
Evaluate Summation:
Description
Japanese help file: sumEval_JPH
Usage
sumEval(sexpr, ..., values = NULL, ntogoback = 1, print = 0, debug = 0)
Arguments
sexpr |
An expression containing summation: s( body, sub,from,to ) |
... |
Replacement of the form pat1=pat2 \ce where the size of pat1 must be equal to pat2. |
values |
A character string consisting of several replacements separated by semicolons. |
print |
= 1 to print the result |
debug |
= 1 to print the intermediate result |
Details
This function converts the summation to sum and evaluates it
using the values of the matrices/vectors given in ... or values
args.
For each summation found, replace it by its expansion as
s(exp[i],{i,1,3}) -> exp[1]+exp[2]+exp[3]
The replacement proceeds from the bottom to top levels.
Examples
modify_math_operators()
## Not run:
mexpr <- "A%*%B%*%C"
sexpr <- mat2sum( mexpr, simple=0 )
printm(mexpr,sexpr)
Eval( mexpr, A=demomat(2,2), B=demomat(2,2)+1, C=diag(2), fullsymb=1 )
sumEval( sexpr, A=demomat(2,2), B=demomat(2,2)+1, C=diag(2), print=1 )
An=demomat(2,2); Bn=demomat(2,2)+1; cn=8:9
values="A=An; B=Bn; c=cn"
mexpr <- "t(A)%*%B%*%c"
sexpr <- mat2sum( mexpr, simple=0 )
printm(mexpr,sexpr)
Eval( mexpr, values=values, fullsymb=1 )
sumEval( sexpr, values=values )
## End(Not run)
[Package lazy.symbolic version 1.0.0.20250830 ]