Description Usage Arguments Details References See Also Examples
Trapezoidal Integration with random partitions
1 | trapezoid_rp(ftn, a, b, n)
|
ftn |
a function of single variable. |
a |
lower bound of the integration. Must be finite. |
b |
upper bound of the integration. Must be finite and assume b > a. |
n |
number of partitions. |
The lengths of the partitions are not equal and the partitions are randomly selected by uniform distribution[a, b]. The uniform distribution has density f(x) = 1/(max - min) for min ≤ x ≤ max.
Owen Jones,Robert Maillardet,Andrew Robinson (2014).Introduction to Scientific Programming and Simulation Using R ; Second Edition
1 2 3 4 5 | ## You can set.seed() before using this function in order
## to lead to the same result.
set.seed(1)
ftn1 <- function(x) return(4 * x^3)
trapezoid_rp(ftn1, 0, 1, n = 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.