Substitute af vector of symbols for a vector of values

subs(s, x, v)

Arguments

s

Expression

x

Names of symbol (vector)

v

Values for x (vector)

Examples

if (has_sympy()) {
   x <- as_sym(paste0('x', 1:3))
   e <- 2*x^2
   e
   subs(e, x, 1:3)
   subs(e, x, x^2)
}
#> [caracas]: ⎡    4      4      4⎤
#>            ⎣2⋅x₁   2⋅x₂   2⋅x₃ ⎦ᵀ