Title: | Gregory Weights for Function Integration |
Version: | 1.0.0 |
Description: | Computes Gregory weights for a given number nodes and function order. Anthony Ralston and Philip Rabinowitz (2001) <ISBN:9780486414546>. |
License: | GPL-3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
Imports: | pracma |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
VignetteBuilder: | knitr |
URL: | https://github.com/dhetting/GregoryQuadrature |
BugReports: | https://github.com/dhetting/GregoryQuadrature/issues |
NeedsCompilation: | no |
Packaged: | 2024-04-22 15:59:46 UTC; dhetting |
Author: | Dylan Hettinger |
Maintainer: | Dylan Hettinger <dhettinger@mines.edu> |
Repository: | CRAN |
Date/Publication: | 2024-04-23 08:40:02 UTC |
Calculate the Gregory quadrature weights for equispaced integration. If f is
a row vector containing the function values, the integral is approximated by
the statement f %*% t(w)
where w are the returned weights. Translated
from https://www.colorado.edu/amath/sites/default/files/attached-files/gregory.pdf.
Description
Calculate the Gregory quadrature weights for equispaced integration. If f is
a row vector containing the function values, the integral is approximated by
the statement f %*% t(w)
where w are the returned weights. Translated
from https://www.colorado.edu/amath/sites/default/files/attached-files/gregory.pdf.
Usage
Gregory_weights(n_nodes, h, order)
Arguments
n_nodes |
Total number of nodes |
h |
Step size |
order |
Order of accuracy desired. 2, 3, 4, ... (with 2 giving the trapezoidal rule). The value must satisfy 2 <= order <= n_nodes |
Value
The weights to be used for the successive function values
Examples
n_nodes = 11
order = 8
h = 2/(n_nodes-1)
x = pracma::linspace(-1, 1, n_nodes)
f = exp(x)
w = GregoryQuadrature::Gregory_weights(n_nodes, h, order)
int = f %*% w
# Exact value for integral
exact = exp(1) - exp(-1)
error = int - exact