Compute Single Order Integral value of a Function in R Programming – integrate() Function
Last Updated :
30 Jun, 2020
integrate()
function in R Language is used to compute single order integral of the function provided.
Syntax: integrate(f, lower, upper)
Parameters:
f: represents a function
lower: represents lower limit of integration
upper: represents upper limit of integration
To know about more option parameters, use below command:
help("integrate")
Example 1:
f<- function (x) x^3 + 2*x
integrate (f, 0, 1)
|
Output:
1.25 with absolute error < 1.4e-14
Example 2:
f <- function (x) {1/((x+1)* sqrt (x))}
integrate (f, lower = 0, upper = 5)
|
Output:
2.300524 with absolute error < 0.00011
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...