I'm new to Mathematica. I have been going through the official reference and came across this article on
rules to which I was led by a Google search on how to evaluate a expression, say
x^2 + 5x - 4 for a certain value of
x. And it worked quite well when I used:
x^2 + 5x - 4 /. x -> 5
But unfortunately, I didn't understand much of what happened when I typed that in. I got that by some trial-and-error with the help of the official reference. But I'd like to fully understand how to use it properly.
To sum up my current knowledge:
ruleis written in the form of
lhs->rhs, as stated in the reference
- It will not modify the actual value of
I know that's ultra-vague. Hence, I'd like to know more about it. Precisely, my questions are:
- What exactly is a rule? The reference states that a rule transforms
lhs->rhs. But that didn't make any sense to me :)
- What exactly takes place when I type in the aforementioned code in Mathematica?
- Where does the
/.operator come into play? I've tried searching about it online but since it is an operator, i.e., made up of symbols, it's incredibly hard to do the same. As it is search engines love to ignore them.
- Side-Request : I'd be glad if you educate me about other aspects I need to know to understand the answers to the above questions.
Finally, I'd like to mention that if this question has been answered before, I'd be glad to read the same, provided it does a good job of answering my questions as mentioned.