gonum: gonum.org/v1/gonum/integrate Index | Files | Directories

package integrate

import "gonum.org/v1/gonum/integrate"

Package integrate provides functions to compute an integral given a specific list of evaluations.

Index

Package Files

doc.go trapezoidal.go

func Trapezoidal Uses

func Trapezoidal(x, f []float64) float64

Trapezoidal estimates the integral of a function f

\int_a^b f(x) dx

from a set of evaluations of the function using the trapezoidal rule. The trapezoidal rule makes piecewise linear approximations to the function, and estimates

\int_x[i]^x[i+1] f(x) dx

as

(x[i+1] - x[i]) * (f[i] + f[i+1])/2

where f[i] is the value of the function at x[i]. More details on the trapezoidal rule can be found at: https://en.wikipedia.org/wiki/Trapezoidal_rule

The (x,f) input data points must be sorted along x. One can use github.com/gonum/stat.SortWeighted to do that. The x and f slices must be of equal length and have length > 1.

Directories

PathSynopsis
quadPackage quad provides numerical evaluation of definite integrals of single-variable functions.

Package integrate imports 1 packages (graph) and is imported by 4 packages. Updated 2019-03-28. Refresh now. Tools for package owners.