Learn R Programming

fntl (version 0.1.1)

gradient0: Numerical Gradient Vector

Description

Numerical Gradient Vector

Usage

gradient0(f, x, args)

Value

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

Arguments

f

Function to differentiate.

x

Vector at which to evaluate the gradient.

args

List of additional arguments from the function richardson_args.

Examples

Run this code
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)

Run the code above in your browser using DataLab