Creating Variables

Any portion or attribute of an object or function created within an application can be stored as a variable. Examples of attributes that can become variables are the area of a rectangle, the radius of a circle, the value contained in a spreadsheet cell or the contents of a row or column or a function expression. When you create a variable, it is stored in memory.

Types of Variables

You can store the following data types as variables:

Data type

Examples

Expression

2.54    1.25E6    2p    xmin/10    2+3i    (xN2)2

List

{2, 4, 6, 8}    {1, 1, 2}    {"red", "blue", "green"}

Matrix

This can be entered as: [1,2,3;3,6,9]

Character string

“Hello”    “xmin/10”    “The answer is:”

Function, programme

myfunc( arg )    ellipse( x, y, r1, r2 )

Measurement

area, perimeter, length, slope, angle

When you click or press h on a handheld to open the list of stored variables, a symbol indicates the type.

Creating a Variable from a Calculator Value

This example shows how to create a variable using a handheld. Complete the following steps to create a variable named num and store the result of the expression 5+83 in that variable.

1. On the Calculator entry line, type the expression 5+8^3.

2. Press ¢ to expand the cursor to the baseline.

3. Press / h and then type the variable name num.

This means: Calculate 5+83 and store the result as a variable named num.

4. Press ·.

Calculator creates the variable num and stores the result there.

Creating a Variable in the Computer Software

When creating a variable in the computer software, use the following conventions. As alternatives to using & (store), you can use “:=” or the Define command. All of the following statements are equivalent.

5+83 & num

num := 5+83

Define num=5+83

Checking a Variable’s Value

You can check the value of an existing variable by entering its name on the Calculator entry line. When you type the name of a stored variable, it appears in bold type.

On the Calculator entry line, type the variable name num and press ·.

The value most recently stored in num is displayed as the result.

Automatically Creating Variables in Graphs & Geometry

In the Graphs and Geometry applications, functions defined on the entry line are automatically stored as variables.

In this example, f1(x)=x3 is a variable definition, which allows it to be displayed in other applications including a table in the Lists & Spreadsheet application.

Creating a Variable from a Graphs & Geometry Value

1. Click the value to store as a variable.

2. Click .
Handheld: Press h.

The Variables options are displayed with Store Var highlighted.

3. Press ·. VAR := appears before the selected value. This is the default name.

4. Replace the default name VAR with the variable name you want to give the value.
5. When the variable name is typed, press ·.

The value is saved to that variable name and the stored value or its name appears in bold text to indicate it is a stored value.

Note: You can also share a Graphs & Geometry axis end value with other applications. If necessary, click Actions, Show/Hide Axes End Values to display the end values on the horizontal and vertical axes. Click the number for an end value to highlight it in the entry field. Name the variable and store it for use with other applications by using any method described in Step 2.

Automatically Creating Variables in Lists & Spreadsheet

Naming a list at the top of a Lists & Spreadsheet column automatically stores that value as a list variable. This variable can be used in other applications including Data & Statistics.

Creating a Variable from a Lists & Spreadsheet Cell Value

You can share a cell value with other applications. When defining or referring to a shared cell in Lists & Spreadsheet, precede the name with an apostrophe (‘).

1. Click the cell that you want to share.
2. Click to open the Variables menu.
Handheld: Press h.

3. Click Store Var.

A formula is inserted into the cell with var as a placeholder for a variable name.

4. Replace the letters “var” with a name for the variable and press ·.

The value is now available as a variable to other applications within the same problem.

Note: If a variable with the name you specified already exists in the current problem space, Lists & Spreadsheet displays an error message.