1. Place the cursor at the end of an expression, insert the symbolic evaluation operator, and type the keyword substitute in the placeholder.
2. After substitute, type a comma and the variable that you want to replace.
3. Insert the Boolean equal sign, and then type the number, variable, or expression that you want to substitute.
4. Press Enter or click outside the region. PTC Mathcad replaces all occurrences of the variable with its substitute value in the result.
5. To substitute a value for one of the expression variables, type a comma plus a the variable and its substitute value in the form var=expr, again using the Boolean equal sign.
6. To substitute values for additional variables, type a comma plus a comma-separated list of the variables and their substitute values.
7. To return results that are not fully simplified, add the modifier raw after substitute.
Additional Information
If you predefine a variable that you later set after substitute, you might not get the result that you expect.
The returned value of 6 is not what you expect. This happens because PTC Mathcad first replaces x with its assigned value of 5, and then it evaluates the expression 5 + 1 to get the following result:
Since 5 does not appear in the expression, PTC Mathcad simply returns 6.
To avoid this problem, you can either clear the substitution variable's symbolic value by using the function
clear.sym, or by using the keyword explicit to temporarily suppress the assigned value of x: