sumEval {lazy.symbolic}R Documentation

Evaluate Summation:

Description

This function converts the summation to sum and evaluates it.
s(exp[i],{i,1,3}) -> exp[1]+exp[2]+exp[3]

Usage

sumEval(sexp, values = NULL, eval = 1, debug = 0)

Arguments

sexp

An expression containing summation: s( body, sub,from,to )

values

replacement pattern for the ranges of subscripts

eval

= 0 to leave Sigma notation

debug

= 1 to print the intermediate result

Details

For each summation found, replace it by its expansion as Sum. The replacement proceeds from the bottom to top levels.

Examples

sumEval( "s(s(a[i,j],{i,1,ni}),{j,1,nj})" , values="ni=2; nj=3")

( sexp=mat2sum("A%*%v",simple=0) )
sumEval( sexp, values="ncol(A)=3" )


[Package lazy.symbolic version 0.1.4 ]