PetscDTTanhSinhIntegrate — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscDTTanhSinhIntegrate

Approximate \(\int_a^b f(x)\,dx\) to a requested precision using adaptive tanh-sinh (double-exponential) quadrature

## Synopsis

    #include "petscdt.h"
    PetscErrorCode PetscDTTanhSinhIntegrate(void (*func)(const PetscReal[], PetscCtx, PetscReal *), PetscReal a, PetscReal b, PetscInt digits, PetscCtx ctx, PetscReal *sol)

Not Collective; No Fortran Support

## Input Parameters

- func - the integrand callback (`func(x, ctx, &value)` evaluates the integrand at point `x`)

- a - lower limit of integration

- b - upper limit of integration

- digits - target number of correct decimal digits

- ctx - optional application context passed to `func`

## Output Parameter

- sol - the approximate value of the integral

## Notes

Doubles the number of quadrature points at each refinement level until the change in the integral falls below the requested tolerance. Suitable for smooth integrands and integrands with endpoint singularities.

For arbitrary-precision arithmetic via MPFR, see `PetscDTTanhSinhIntegrateMPFR()`.

## See Also

`PetscDTTanhSinhIntegrateMPFR()`, `PetscDTGaussQuadrature()`

## Level

developer

## Location

src/dm/dt/interface/dt.c

Index of all DT routines
Table of Contents for all manual pages
Index of all manual pages