vectorized_Faa_di_Bruno {ElliptCopulas}R Documentation

Vectorized version of Faa di Bruno formula

Description

This code implements a vectorized version of the Faa di Bruno formula, relying internally on the Bell polynomials from the package kStatistics, via the function kStatistics::eBellPol.

Usage

vectorized_Faa_di_Bruno(f, g, x, k, args_f, args_g)

Arguments

f, g

two functions that take in argument

  • a vector x of numeric values

  • an integer k which is as to be understood as the order of the derivative of f

  • potentially other parameters (not vectorized)

x

vector of (one-dimensional) values at which the k-th order derivatives is to be evaluated.

k

the order of the derivative

args_f, args_g

the list of additional parameters to be passed on to f and g. This must be the same for all values of x.

Value

a vector of size length(x) for which the i-th component is (f \circ g)^{(k)} (x[i])

Author(s)

Alexis Derumigny, Victor Ryan

See Also

compute_matrix_alpha which also uses the Bell polynomials in a similar way.

Examples

g <- function(x, k, a){
  if (k == 0){ return ( exp(x) + a)
  } else {
    return (exp(x))
  }
}
args_g = list(a = 2)

f <- function(x, k, a){
  if (k == 0){ return ( x^2 + a)
  } else if (k == 1) {
    return ( 2 * x)
  } else if (k == 2) {
    return ( 2 )
  } else {
    return ( 0 )
  }
}
args_f = list(a = 5)

x = 1:5
vectorized_Faa_di_Bruno(f = f, g = g, x = x, k = 1,
  args_f = args_f, args_g = args_g)
# Derivative of ( exp(x) + 2 )^2 + 5
# which explicit expression is:
2 * exp(x) * ( exp(x) + 2 )


[Package ElliptCopulas version 0.1.4.1 Index]