e_MFB: Evaluation of Faa di Bruno's formula

View source: R/e_MFB.R

e_MFBR Documentation

Evaluation of Faa di Bruno's formula

Description

The function evaluates the Faa di Bruno's formula, output of the MFB function, when the coefficients of the exponential formal power series f and g1,...,gn in the composition f[g1(),...,gn()] are substituted with numerical values.

Usage

e_MFB(pv = c(), pn = 0, pf = c(), pg = c(), b = FALSE)

Arguments

pv

vector of integers, the subscript of Faa di Bruno's formula

pn

integer, the number of the inner formal power series "g"

pf

vector, the numerical values in place of the coefficients of the outer formal power series "f" or the string with the direct assignments in place of the coefficients of both "f" and "g"

pg

vector, the numerical values in place of the coefficients of the inner formal power series "g" [Optional if pf is a string]

b

boolean

Details

The output of the MFB function is a coefficient of the exponential formal power series compositions in the cases

a) univariate f with univariate g
b) univariate f with multivariate g
c) multivariate f with multivariates {gi}

The e_MFB function evaluates this coefficient when the coefficients of f and {gi} are substituted with numerical values. These values are passed to the e_MFB function trough the third and the fourth input parameter. There is one further input boolean parameter: when equal to TRUE, the function prints the list of all the assignments. See the examples for more details on how to use this boolean parameter when the expression of the coefficients of f and {gi} becomes more complex.

Value

numerical

the evaluation of Faa di Bruno's formula

Warning

The value of the first parameter is the same as the mkmSet function.

Note

Called from the MFB function in the kStatistics package.

Author(s)

Elvira Di Nardo elvira.dinardo@unito.it,
Giuseppe Guarino giuseppe.guarino@rete.basilicata.it

References

E. Di Nardo, G. Guarino, D. Senato (2008) An unifying framework for k-statistics, polykays and their generalizations. Bernoulli. Vol. 14(2), 440-468. (download from http://www.elviradinardo.it/lavori1.html)

E. Di Nardo, G. Guarino, D. Senato (2008) Symbolic computation of moments of sampling distributions. Comp. Stat. Data Analysis Vol. 52(11), 4909-4922, (download from http://www.elviradinardo.it/lavori1.html)

E. Di Nardo, G. Guarino, D. Senato (2011) A new algorithm for computing the multivariate Faa di Bruno's formula. Appl. Math. Comp. 217, 6286–6295. (download from https://arxiv.org/abs/1012.6008)

See Also

mkmSet, MFB

Examples


# The numerical value of f[1]g[1,1] + f[2]g[1,0]g[0,1], that is the coefficient of z1z2 in 
# f(g1(z1,z2),g2(z1,z2))) output of MFB(c(1,1),1) when 
# f[1] = 5 and f[2] = 10 
# g[0,1]=3,  g[1,0]=6,  g[1,1]=9
e_MFB(c(1,1),1, c(5,10), c(3,6,9))

# Same as the previous example, with a string of assignments as third input parameter
e_MFB(c(1,1),1, "f[1]=5, f[2]=10, g[0,1]=3, g[1,0]=6, g[1,1]=9")


# Use the boolean parameter to verify the assignments to the coefficients of "f" and "g", 
# that is f[1]=5, f[2]=10, g[0,1]=3, g[1,0]=6, g[1,1]=9
e_MFB(c(1,1),1, c(5,10), c(3,6,9), TRUE)

# To recover which coefficients are involved, run the function without any assignment. 
# The error message recalls which coefficients are necessary, that is
# e_MFB(c(1,1),1)
# Error in e_MFB(c(1, 1), 1) : 
#   The third parameter must contain the 2 values of f: f[1] f[2]. 
#   The fourth parameter must contain the 3 values of g: g[0,1] g[1,0] g[1,1]

# To assign correctly the values to the coefficients of "f" and "g" when the functions 
# become more complex:
# 1) run e_MFB(c(1,1),2) and get the errors with the indication of the involved coefficients 
#    of "f" and "g", that is 
#      The third parameter must contain the 5 values of f: 
#                      f[0,1] f[0,2] f[1,0] f[1,1] f[2,0]
#      The fourth parameter must contain the 6 values of g: 
#                      g1[0,1] g1[1,0] g1[1,1] g2[0,1] g2[1,0] g2[1,1]"
# 2) initialize f[0,1] f[0,2] f[1,0] f[1,1] f[2,0] with - for example - the first 5 integer 
#    numbers and do the same for g1[0,1] g1[1,0] g1[1,1] g2[0,1] g2[1,0] g2[1,1], that is
#    e_MFB(c(1,1),2, c(1:5), c(1:6), TRUE)
# 3) trought the boolean value TRUE, recover the string f[0,1]=1, f[0,2]=2, f[1,0]=3, f[1,1]=4, 
#    f[2,0]=5, g1[0,1]=1, g1[1,0]=2, g1[1,1]=3, g2[0,1]=4, g2[1,0]=5, g2[1,1]=6
# 4) copy and past the string in place of " ... " when run 
#    e_MFB(c(1,1),1," ... ")
# 5) change the assignments if necessary
cfVal<-"f[0,1]=2, f[0,2]=5, f[1,0]=13, f[1,1]=-4, f[2,0]=0"
cgVal<-"g1[0,1]=-2.1, g1[1,0]=2,g1[1,1]=3.1, g2[0,1]=5, g2[1,0]=0, g2[1,1]=6.1"
cVal<-paste0(cfVal,",",cgVal)
e_MFB(c(1,1),2,cVal)

kStatistics documentation built on June 8, 2022, 5:05 p.m.