trapezoid: Trapezoidal Integration

Description Usage Arguments Details References See Also Examples

Description

The numerical integration of ftn from a to b,using the trapezoidal rule with n subdivisions.

Usage

1
trapezoid(ftn, a, b, n = 100)

Arguments

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.

Details

The integration calculates the trapezoid area of each subdivisions and sums them up.

References

Owen Jones,Robert Maillardet,Andrew Robinson (2014).Introduction to Scientific Programming and Simulation Using R ; Second Edition

See Also

integrate

Examples

1
2
ftn1 <-  function(x) return(4 * x^3)
trapezoid(ftn1, 0, 1, n = 100)

david850803/MC.makes.perfect documentation built on June 16, 2019, 12:04 a.m.