Examples:
Type the following statements in a Maple worksheet. What do you expect a3 to contain?
a1 := h*v a2 := k*T a3 := exp(-a1/a2)
Comment: Use the
:=
to assign names to terms in the final expression. NEVER use the same name to label two different expressions or equations. The name will be associated with the last expression assigned. This can be very confusing to Maple and will often create difficult-to-find errors for the user. Instead, assign a descriptive name or a sequence of simple names as was done in this example.Type the following statements in a Maple worksheet. What do you expect c2 to contain?
c1 := (x+y)/z c2 := c1^2+5*x+6
Comment: Note how the expression named
c1
is put every place thatc1
appears in the second expression namedc2
. Also note that the second term5*x
may be wrong. If you intended it to be5*c1
, just position the cursor in the previously typed expression, deletex
and type inc1
and strike the Enter key. Maple treats mathematical statements like sentences in a word processor. You can go back and modify any statement to correct errors. HOWEVER, if later expressions depend upon a statement that you modified, you must type the Enter key repeatedly to reexecute the remaining statements until you have executed the entire subsequent math so that your change is updated in each of the subsequent expressions.Type the following statements in a Maple worksheet.
MessyTerm := x/y+z QuadraticExpressionWithMessyTerm := MessyTerm^2 + 5*MessyTerm + 6
Comment: This demonstrates that you can be creative with names if you wish.
Type the following statements in a Maple worksheet. What do you expect b3 to contain?
b1 := h*v b2 := k*T v := 1.5 b3 := exp(-b1/b2)
Comment: Do not use variable names as the names of expressions. Even if this was your intended result for this problem, you have effectively removed the variable
v
from your work. You will no longer be able to sub for different values ofv
since it will always be the value 1.5. It was a variable in the first expression, but once it was used as the name of an expression, it will never appear as a variable in subsequent statements.Instead, use the
subs
command (shown in a later lesson) to substitute values temporarily while preserving the ability to sub different values for a variable at a later point in your work.