Learn R Programming

caracas (version 1.0.1)

sumf: Sum of a function

Description

Sum of a function

Usage

sumf(f, var, lower, upper, doit = TRUE)

Arguments

f

Function to take sum of

var

Variable to take sum for (either string or caracas_symbol)

lower

Lower limit

upper

Upper limit

doit

Evaluate the sum immediately (or later with doit())

Examples

Run this code
# NOT RUN {
if (have_sympy()) {
  x <- symbol("x")
  s <- sumf(1/x, "x", 1, 10)
  as_r(s)
  sum(1/(1:10))
  n <- symbol("n")
  simplify(sumf(x, x, 1, n))
}

# }

Run the code above in your browser using DataLab