Functionals: integration and
algebraic equations
In the BUGS language logical nodes can be functions of other logical nodes. Sometimes a logical node is needed that depends on another logical node evaluated at arbitary points. One example is an definite integral and another is an algebraic equation. We call these more general logical nodes "functionals" and introduce a special notation to describe them. A slot in a logical node that has a F(z) parameter is able to ask the F(z) logical node to be evaluated at any value of its special argument z.
Two examples:
integral(F(x), lower, upper, tol) is functional that evaluates the definite integral of F(x) with
repect to x between lower and upper with an acuracy of tol,
solution(F(x), lower, upper, tol) finds a solution of the algebraic equation F(x) = 0 lying
between lower and upper with acuracy tol.
In the simple model the functionals do not depend on any stochastic nodes and hence reduce to constatnts. Set the prec field in the "Display options" to 10 and then use the "Node info..." tool to see the values of int, sol and zero.
int 1.0
sol 0.3459548158
zero -6.9388939E-17
model{
F(x[1]) <- cos(x[1])
int <- integral(F(x[1]), 0, halfPi, 1.0E-6)
halfPi <- 3.141592659 / 2
sol <- solution(F(x[2]), 0, 1, 1.0E-6)
F(x[2]) <- x[2] * x[2] - pow(1 - x[2], 5)
zero <- sol * sol - pow(1 - sol, 5)
int1 <- integral(F(x[3]), 0, limit, 1.0E-6)
F(x[3]) <- cos(x[3]) * cos(x[3]) + sin(x[3]) * sin(x[3])
limit ~ dunif(0, 1)
}
list(limit = 0.5)
list(x = c(0, 0, NA))