fcts | R Documentation |
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.
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.
funs
A list containing the specified functions. This slot should not be accessed and is used only internally.
d()
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.