NumericalIntegration class

A class providing various numerical integration methods for calculating definite integrals of functions.

This class implements several numerical integration techniques ranging from basic methods like the trapezoidal and Simpson's rules to more advanced techniques like Romberg integration and Gaussian quadrature.

Example:

// Integrate f(x) = x^2 from 0 to 1
double f(double x) => x * x;

var result = NumericalIntegration.trapezoidal(f, 0, 1, n: 1000);
print('Integral: $result'); // ~0.333333

Constructors

NumericalIntegration()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

adaptiveSimpson(dynamic f(num), num a, num b, {double tolerance = 1e-6, int maxDepth = 50}) → dynamic
Computes the definite integral using adaptive Simpson's rule.
doubleIntegral(dynamic f(num, num), num ax, num bx, dynamic ay(num), dynamic by(num), {int nx = 50, int ny = 50}) → dynamic
Computes a double integral over a rectangular region.
gaussianQuadrature(dynamic f(num), num a, num b, {int order = 5}) → dynamic
Computes the definite integral using Gaussian quadrature.
integrateWithError(dynamic f(num), num a, num b, {double tolerance = 1e-6}) → Map<String, dynamic>
Computes a definite integral with error estimation.
monteCarloIntegral(dynamic f(List<num>), List<num> lower, List<num> upper, {int samples = 10000, int? seed}) → dynamic
Computes a multi-dimensional integral using Monte Carlo integration.
romberg(dynamic f(num), num a, num b, {double tolerance = 1e-6, int maxDepth = 10}) → dynamic
Computes the definite integral using Romberg integration.
simpsons(dynamic f(num), num a, num b, {int n = 100}) → dynamic
Computes the definite integral using Simpson's rule.
trapezoidal(dynamic f(num), num a, num b, {int n = 100}) → dynamic
Computes the definite integral using the trapezoidal rule.
tripleIntegral(dynamic f(num, num, num), num ax, num bx, dynamic ay(num), dynamic by(num), dynamic az(num, num), dynamic bz(num, num), {int nx = 20, int ny = 20, int nz = 20}) → dynamic
Computes a triple integral over a rectangular region.