# NOT RUN {
#----------------------------------------#
# Univariate f with Univariate g #
#----------------------------------------#
# The coefficient of z^2 in f(g(z)), that is f[2]g[1]^2 + f[1]g[2], where
# f[1] is the coefficient of t in f(t) with t=g(z)
# f[2] is the coefficient of t^2 in f(t) with t=g(z)
# g[1] is the coefficient of z in g(z)
# g[2] is the coefficient of z^2 in g(z)
#
MFB( c(2), 1 )
# The coefficient of z^3 in f(g(z)), that is f[3]g[1]^3 + 3f[2]g[1]g[2] + f[1]g[3]
#
MFB( c(3), 1 )
#----------------------------------------#
# Univariate f with Multivariate g #
#----------------------------------------#
# The coefficient of z1 z2 in f(g(z1,z2)), that is f[1]g[1,1] + f[2]g[1,0]g[0,1]
# where
# f[1] is the coefficient of t in f(t) with t=g(z1,z2)
# f[2] is the coefficient of t^2 in f(t) with t=g(z1,z2)
# g[1,0] is the coefficient of z1 in g(z1,z2)
# g[0,1] is the coefficient of z2 in g(z1,z2)
# g[1,1] is the coefficient of z1 z2 in g(z1,z2)
#
MFB( c(1,1), 1 )
# The coefficient of z1^2 z2 in f(g(z1,z2))
#
MFB( c(2,1), 1 )
# The coefficient of z1 z2 z3 in f(g(z1,z2,z3))
#
MFB( c(1,1,1), 1 )
#-------------------------------------------------#
# Multivariate f with Multivariate g1, g2, ... #
#-------------------------------------------------#
# The coefficient of z in f(g1(z),g2(z)), that is f[1,0]g1[1] + f[0,1]g2[1] where
# f[1,0] is the coefficient of t1 in f(t1,t2) with t1=g1(z) and t2=g2(z)
# f[0,1] is the coefficient of t2 in f(t1,t2) with t1=g1(z) and t2=g2(z)
# g1[1] is the coefficient of z of g1(z)
# g2[1] is the coefficient of z of g2(z)
MFB( c(1), 2 )
# The coefficient of z1 z2 in f(g1(z1,z2),g2(z1,z2)), that is
# f[1,0]g1[1,1] + f[2,0]g1[1,0]g1[0,1] + f[0,1]g2[1,1] + f[0,2]g2[1,0]g2[0,1] +
# f[1,1]g1[1,0]g2[0,1] + f[1,1]g1[0,1]g2[1,0] where
# f[1,0] is the coefficient of t1 in f(t1,t2) with t1=g1(z1,z2) and t2=g2(z1,z2)
# f[0,1] is the coefficient of t2 in f(t1,t2) with t1=g1(z1,z2) and t2=g2(z1,z2)
# g1[1,1] is the coefficient of z1z2 in g1(z1,z2)
# g1[1,0] is the coefficient of z1 in g1(z1,z2)
# g1[0,1] is the coefficient of z2 in g1(z1,z2)
# g2[1,1] is the coefficient of z1 z2 in g2(z1,z2)
# g2[1,0] is the coefficient of z1 in g2(z1,z2)
# g2[0,1] is the coefficient of z2 in g1(z1,z2)
MFB( c(1,1), 2 )
# The coefficient of z1 in f(g1(z1,z2),g2(z1,z2),g3(z1,z2))
MFB( c(1,0), 3 )
# The coefficient of z1 z2 in f(g1(z1,z2),g2(z1,z2),g3(z1,z2))
MFB( c(1,1), 3 )
# The coefficient of z1^2 z2 in f(g1(z1,z2),g2(z1,z2))
MFB( c(2,1), 2 )
# The coefficient of z1^2 z2 in f(g1(z1,z2),g2(z1,z2),g3(z1,z2))
MFB( c(2,1), 3 )
# The previous result expressed in a compact form
for (m in unlist(strsplit( MFB(c(2,1),3), " + ", fixed=TRUE)) ) cat( m,"\n" )
# The coefficient of z1 z2 z3 in f(g1(z1,z2,z3),g2(z1,z2,z3),g3(z1,z2,z3))
MFB( c(1,1,1), 3 )
# The previous result expressed in a compact form
for (m in unlist(strsplit( MFB(c(1,1,1),3), " + ", fixed=TRUE)) ) cat( m,"\n" )
# }
Run the code above in your browser using DataLab