Learn R Programming

boostmath (version 1.0.0)

numerical_differentiation: Numerical Differentiation

Description

Functions for numerical differentiation using finite difference methods and complex step methods.

Usage

finite_difference_derivative(f, x, order = 1)

complex_step_derivative(f, x)

Value

The approximate value of the derivative at the point x.

Arguments

f

A function to differentiate. It should accept a single numeric value and return a single numeric value.

x

The point at which to evaluate the derivative.

order

The order of accuracy of the derivative to compute. Default is 1.

Examples

Run this code
# Finite difference derivative of sin(x) at pi/4
finite_difference_derivative(sin, pi / 4)
# Complex step derivative of exp(x) at 1.7
complex_step_derivative(exp, 1.7)

Run the code above in your browser using DataLab