subs_lst {caracas}R Documentation

Substitute symbol for of value given by a list

Description

Useful for substituting solutions into expressions.

Usage

subs_lst(s, x)

Arguments

s

Expression

x

Named list of values

See Also

subs(), subs_vec()

Examples

if (has_sympy()) {
     p <- as_sym(paste0("p", 1:3))
     y <- as_sym(paste0("y", 1:3))
     a <- as_sym("a")
     l <- sum(y*log(p))
     L <- -l + a*(sum(p) - 1)
     g <- der(L, c(a, p))
     sols <- solve_sys(g, c(a, p))
     sol <- sols[[1L]]
     sol
     H <- der2(L, c(p, a))
     H
     H_sol <- subs_lst(H, sol)
     H_sol
}


[Package caracas version 1.1.0 Index]