int: Integrate a function

View source: R/calculus.R

intR Documentation

Integrate a function

Description

If no limits are provided, the indefinite integral is calculated. Otherwise, if both limits are provided, the definite integral is calculated.

Usage

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

Arguments

f

Function to integrate

var

Variable to integrate with respect to (either string or caracas_symbol)

lower

Lower limit

upper

Upper limit

doit

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

Examples

if (has_sympy()) {
  x <- symbol("x")
  
  int(1/x, x, 1, 10)
  int(1/x, x, 1, 10, doit = FALSE)
  int(1/x, x)
  int(1/x, x, doit = FALSE)
  int(exp(-x^2/2), x, -Inf, Inf)
  int(exp(-x^2/2), x, -Inf, Inf, doit = FALSE)
}


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