FastTanhSinhQuadrature.jl

Stable Dev Build Status Coverage

FastTanhSinhQuadrature.jl is a high-performance Julia library for numerical integration using the Tanh-Sinh (Double Exponential) quadrature method.

It handles singularities at endpoints robustly, supports arbitrary precision arithmetic (e.g., BigFloat, Double64), and leverages SIMD for speed.

The implementation follows the method introduced by Takahasi & Mori (1973).

Convergence of Tanh-Sinh Quadrature

Quick Start

using FastTanhSinhQuadrature

# High-level adaptive integration
val = quad(exp, 0.0, 1.0)  # ≈ e - 1

# Handle singularities
f(x) = 1 / sqrt(abs(x))
val = quad_split(f, 0.0, -1.0, 1.0)  # Split at singularity

# Pre-computed nodes for maximum performance
x, w, h = tanhsinh(Float64, 80)
val = integrate1D(sin, x, w, h)

# SIMD-accelerated (2-3x faster)
val = integrate1D_avx(sin, x, w, h)

Key Features

  • Arbitrary Precision: Float32, Float64, BigFloat, Double64
  • High Performance: SIMD-accelerated _avx variants
  • Multidimensional: 1D, 2D, and 3D integration
  • Adaptive Integration: quad and quad_split functions
  • Singularity Handling: Robust at endpoints and interior points
  • Double Exponential Convergence: Machine precision with few points

Contents