sum_: Sum of a function

View source: R/calculus.R

sum_R Documentation

Sum of a function

Description

Sum of a function

Usage

sum_(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

if (has_sympy()) {
  x <- symbol("x")
  s <- sum_(1/x, "x", 1, 10)
  as_expr(s)
  sum(1/(1:10))
  n <- symbol("n")
  simplify(sum_(x, x, 1, n))
}


caracas documentation built on June 22, 2024, 10:59 a.m.