qnwsimp: Simpson's rule quadrature nodes and weights

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/qnwsimp.R

Description

Generates Simpson's rule quadrature nodes and weights for computing the definite integral of a real-valued function defined on a hypercube [a,b] in R^d.

Usage

1
qnwsimp(n, a = rep(0, length(n)), b = rep(1, length(n)))

Arguments

n

1.d number of nodes per dimension (must be odd positive integers)

a

1.d left endpoints

b

1.d right endpoints

Value

List with fields

Author(s)

Randall Romero-Aguilar, based on Miranda & Fackler's CompEcon toolbox

References

Miranda, Fackler 2002 Applied Computational Economics and Finance

See Also

Other quadrature functions: qnwequi; qnwlege; qnwlogn; qnwnorm; qnwtrap; qnwunif; quadrature

Examples

1
2
3
4
5
6
7
8
# To compute definte integral of a real-valued function f defined on a hypercube
# [a,b] in R^d, write a function f that returns an m.1 vector when passed an
# m.d matrix, and write
q <- qnwsimp(n,a,b,type);
Intf <- crossprod(q$w, f(q$x))

# Alternatively, use the quadrature function
Intf <- quadrature(f,qnwnsimp,n,a,b)

randall-romero/CompEconR documentation built on May 26, 2019, 10:56 p.m.