subs | R Documentation |
Substitute symbol for value
subs(sym, nms, vls)
sym |
Expression |
nms |
Names of symbols (see Details) |
vls |
Values that |
Two different ways to call this function is supported:
Supplying nms
as a named list and omitting vls
.
If two components have the same name, the behaviour is undefined.
Supplying both nms
and vls
See Examples.
if (has_sympy()) {
x <- symbol('x')
e <- 2*x^2
e
subs(e, "x", "2")
subs(e, x, 2)
subs(e, list(x = 2))
A <- matrix_sym(2, 2, "a")
B <- matrix_sym(2, 2, "b")
e <- A %*% A
subs(e, A, B)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.