#approximation #derivative #automatic-differentiation #difference #numerical #vector #multivariate

numdiff

Numerical differentiation via forward-mode automatic differentiation and finite difference approximations

6 releases

0.1.5 Jan 1, 2025
0.1.4 Dec 31, 2024
0.1.1 Nov 25, 2024

#930 in Rust patterns

Download history 229/week @ 2024-11-20 59/week @ 2024-11-27 6/week @ 2024-12-04 7/week @ 2024-12-11 312/week @ 2024-12-25 202/week @ 2025-01-01

524 downloads per month

MIT/Apache

315KB
5K SLoC

numdiff

github crates.io docs.rs

Automatic and numerical differentiation.

Documentation

Please see https://docs.rs/numdiff.

Overview

This crate implements two different methods for evaluating derivatives in Rust:

  1. Automatic differentiation (forward-mode using first-order dual numbers).
  2. Numerical differentiation (using forward difference and central difference approximations).

This crate provides generic functions (for numerical differentiation) and macros (for automatic differentiation) to evaluate various types of derivatives of the following types of functions:

  • Univariate, scalar-valued functions (f: ℝ → ℝ)
  • Univariate, vector-valued functions (f: ℝ → ℝᵐ)
  • Multivariate, scalar-valued functions (f: ℝⁿ → ℝ)
  • Multivariate, vector-valued functions (f: ℝⁿ → ℝᵐ)

These functions and macros are made generic over the choice of vector representation, as long as the vector type implements the linalg_traits::Vector trait. See the linalg_traits documentation for more information.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~190–285KB