library(dfdr)
d(sin, x)
f <- function(x) -sin(x)
d(f, x)
# 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)
d(g, z, lst)
Run the code above in your browser using DataLab