Compute Single Order Integral value of a Function in R Programming – integrate() Function

function in R Language is used to compute single order integral of the function provided.**integrate()**

Syntax:integrate(f, lower, upper)

Parameters:f:represents a functionlower:represents lower limit of integrationupper:represents upper limit of integration

To know about more option parameters, use below command:

help("integrate")

**Example 1:**

`# Create function` `f<-` `function` `(x) x^3 + 2*x` ` ` `# Integrate from 0 to 1` `integrate` `(f, 0, 1)` |

**Output:**

1.25 with absolute error < 1.4e-14

**Example 2:**

`# Create function` `f <- ` `function` `(x) {1/((x+1)*` `sqrt` `(x))}` ` ` `# Integrate from 0 to 5` `integrate` `(f, lower = 0, upper = 5)` |

**Output:**

2.300524 with absolute error < 0.00011