Substitute symbol for value

subs_single(s, x, v)

Arguments

s

Expression

x

Name of symbol (character)

v

Value for x

See also

Examples

if (has_sympy()) {
   x <- symbol('x')
   e <- 2*x^2
   e
   subs_single(e, "x", "2")
   y <- as_sym("2")
   subs_single(e, "x", y)
}
#> [caracas]: 8