The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Version: 0.1.1
Date: 2022-07-09
Title: Gram Quadrature
Description: Numerical integration with Gram polynomials (based on <doi:10.48550/arXiv.2106.14875> [math.NA] 28 Jun 2021, by Irfan Muhammad [School of Computer Science, University of Birmingham, UK]).
Depends: R (≥ 4.0)
Imports: pracma, compiler
License: GPL-3
URL: https://gitlab.com/iagogv/GramQuad
BugReports: https://gitlab.com/iagogv/GramQuad/-/issues
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2022-07-09 09:11:54 UTC; iago
Author: Iago Giné-Vázquez ORCID iD [aut, cre, trl], Irfan Muhammad [aut]
Maintainer: Iago Giné-Vázquez <iago.gin-vaz@protonmail.com>
Repository: CRAN
Date/Publication: 2022-07-09 14:00:01 UTC

Compute Gram weights

Description

Computes weights for Gram quadrature ofm+1 points.

Usage

create_gram_weights(m)

Arguments

m

a positive integer value, the number of points minus one for which weights will be computed. See 'Details'.

Details

The numerical integration of an analytical function f(x) using a finite set of equidistant points can be performed by quadrature formulas like the Newton-Cotes. Unlike Gaussian quadrature formulas however, higher-order Newton-Cotes formulas are not stable, limiting the usable order of such formulas. Existing work showed that by the use of orthogonal polynomials, stable high-order quadrature formulas with equidistant points can be developed. This algorithm improves upon such work by making use of (orthogonal) Gram polynomials and deriving an iterative algorithm, together allowing us to reduce the space-complexity of the original algorithm significantly.

Value

A double-precision vector of the specified length plus one, whose elements are the weights for the Gram quadratures of the m+1 points in the interval [-1,1].

Author(s)

Iago Giné-Vázquez, iago.gin-vaz@protonmail.com

References

Muhammad, Irfan (2021) Gram quadrature: Numerical integration with Gram polynomials. arXiv:2106.14875 [math.NA]

See Also

gaussLegendre

Examples

m <- 100
xs <- seq(-1, 1, length.out = m + 1)
gram_weights <- create_gram_weights(m)

# the sum of  stable  weights is  equal  to 2.
cat("Sum of Gram weights:", sum(gram_weights), "\n")

# test integration, integrate f below between [-1,1]
f = function(x){ 9 * x ^ 2 + 45 * 13 * x ^ 3 + 16 * x ^ 4}
gram_quad <- sum(gram_weights * f(xs))
cat("Approx. integration:", gram_quad, "\n")

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.