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

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)
}
#> c: ∞              
#>
#>    ⎮     ⎛  2 ⎞   
#>    ⎮     ⎜-x  ⎟   
#>    ⎮  exp⎜────⎟ dx
#>    ⎮     ⎝ 2  ⎠   
#>
#>    -∞