gradient0: Numerical Gradient Vector

View source: R/RcppExports.R

gradient0R Documentation

Numerical Gradient Vector

Description

Numerical Gradient Vector

Usage

gradient0(f, x, args)

Arguments

f

Function to differentiate.

x

Vector at which to evaluate the gradient.

args

List of additional arguments from the function richardson_args.

Value

A list with the form of a gradient_result described in section "Gradient" of the package vignette.

Examples

f = function(x) { sum(sin(x)) }
args = richardson_args()
x0 = seq(0, 1, length.out = 5)
cos(x0)  ## Exact answer
gradient0(f, x0, args)
numDeriv::grad(f, x0)


fntl documentation built on April 4, 2025, 1:53 a.m.