R/calculus.R
sum_.Rd
Sum of a function
sum_(f, var, lower, upper, doit = TRUE)
Function to take sum of
Variable to take sum for (either string or caracas_symbol)
caracas_symbol
Lower limit
Upper limit
Evaluate the sum immediately (or later with doit())
doit()
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)) } #> c: n⋅(n + 1) #> ───────── #> 2