{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Worksheet02

# Worksheet02 - Maple for Math Majors Roger Kraft Department...

This preview shows pages 1–3. Sign up to view the full content.

Maple for Math Majors Roger Kraft Department of Mathematics, Computer Science, and Statistics Purdue University Calumet [email protected] 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;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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). > x; Converting an assigned variable back into an unassigned variable is an important, and very common, operation in Maple. We will refer to this operation as unassigning a variable. It may seem odd to use an assignment statement to unassign a variable. It helps to think of unassigned variables as variables whose value is themselves (as opposed to thinking of them as variables that do not have a value).
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern