This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Maple for Math Majors Roger Kraft Department of Mathematics, Computer Science, and Statistics Purdue University Calumet email@example.com 2. Variables, Assignment, and Equations 2.1. Introduction In this worksheet we look at how Maple treats variables and at Maple's rules for how variables can be named. We also look at how variables are given values with the assignment operator, and we compare Maple's use of the assignment operator and the equal sign with the standard mathematical use of the equal sign in equations. > 2.2. Assigned and unassigned variables Every variable in Maple will have one of two states; either it is an assigned variable, or it is an unassigned variable. Assigned variables are names for some value. In other words, an assigned variable is a name that represents something. An assigned variable can represent almost anything, a number, an expression, a function, an equation, a graph, a solution, a list of things, another variable, etc. Assigned variables are sometimes called "programming variables" because they act, more or less, like the variables in traditional programming languages. Assigned variables are also sometimes referred to as a "label for a result" or simply as "labels". Unassigned variables are names that do not yet represent a particular value. Unassigned variables are sometimes called "free variables", because they are free to take on any value. They are also sometimes called "unknowns" because they do not have a value. Other terms used as synonyms for "unassigned variables" are, mathematical variables, mathematical symbols, mathematical unknowns, algebraic unknowns, and indeterminates. All variables begin their life in Maple as unassigned variables. To change an unassigned variable to an assigned one, we use the assignment operator , which is a colon followed by an equal sign (i.e. := ). A Maple command with an assignment operator in it is called an assignment statement . Here are some examples of assigned and unassigned variables. Until you give the variable x a value, x is an unassigned variable. We sometimes say that an unassigned variable represents itself. > x; Let us change x into an assigned variable. > x := 3; Now x represents the integer 3. (Sometimes we will say "the value of x is 3". Other times we might say " x is a name for 3", or " x refers to 3", or " x has the value 3", or " x is a label for 3", or "3 is assigned to x ".) > x; Here is how we change x back into an unassigned variable. We assign to x a right quoted copy of x . (Right quotes are the single quotes found on the right hand side of the keyboard.) > x := 'x'; # Those are both right quotes. Now x represents itself again (or, we can say that x no longer has a value)....
View Full Document