fcts: S4 class _fcts_

fctsR Documentation

S4 class fcts

Description

A S4 class containing additional functions which can be used for calculating derivatives with d().
To create a class the function fcts() should be used.
Adding functions is only possible via the function add_fct.

Details

The following functions are already supported:
sin, sinh, asin, cos, cosh, acos, tan, tanh, atan, exp, log, sqrt, c, vector, numeric, rep and matrix.
Notably, for the functions: c, vector, numeric, rep and matrix the function is ignored during differentiation.

Slots

funs

A list containing the specified functions. This slot should not be accessed and is used only internally.

See Also

d()

Examples

library(dfdr)
# Initialize list
lst <- dfdr::fcts()

# The function which should be added
f <- function(x) x^2
# The dervative function of f
f_deriv <- function(x) 2*x

# add new entry to list
lst <- fcts_add_fct(lst, f, f_deriv)

g <- function(z) f(z)
df <- d(g, z, lst)
df

mailund/dfdr documentation built on Feb. 25, 2023, 5:37 p.m.