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, function, expression, or number 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 function with a different function, type a comma plus the name of the original function and the name of the substitute function.
6. To substitute a number with a function, type a comma plus the original number and the name of the substitute function.
7. To substitute an expression with a function, type a comma plus the expression and the name of the substitute function.
8. 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.
9. To substitute values for additional variables, type a comma plus a comma-separated list of the variables and their substitute values.
10. 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: