Brand new user here. How to substitute values of multiple variables into an expression?
I try:
n + m /. {n, m} -> {2, 4}
# produces `m+n` as output
# or alternatively
n + m /. n->2, m->4
# gives blank output
n+5 ./ n->2 works and produces 7 as output.
Is ./ only for single variable substitutions?
n + m /. Thread[{n, m} :> {2, 4}]would be one way – user1066 Aug 10 '20 at 19:08n + m /. {n->2, m->4}. Useful to understand difference between Replace and ReplaceAll (.) for future work. – PaulCommentary Aug 10 '20 at 19:15/.) and hit F1 to access the documentation on that function (which isReplaceAll). Two of the examples underBasic Examplesshow you exactly what you need. – march Aug 10 '20 at 20:11