# Variables

### How do I define my own units? TOP

Define a variable with the name and value you want.

To define a variable enter and evaluate the variable definition in the UnitMath window. The variables definition consists of the variable's name followed by a colon : followed by the value for the variable. When defining several variables at once it is convenient to separate the definitions with semicolons ;.

Pool's_Diameter: 155. inches;
Pool's_Depth: 6 inches;
Water's_Density: gram/cc

### What if I don't like the way you defined a unit? TOP

Define a variable with the same name as the unit you want to redefine. Until that variable is deleted it will be used in place of the existing variable in all your calculations. The variable will have no effect on existing units.

pint: pint_Imperial;
gallon: gallon_Imperial;
quart: quart_Imperial

### What if the unit I want is based on an equation? TOP

Define a variable with name you want with the desired equation as its value.

Sphere's_Volume: 4/3 * pi cu radius;

### In what order do I need to define my variables? TOP

Generally any order. The value a variable returns is based on the value of all its parts when evaluated not when defined.
Circle's_Area ~ 0.05 sq m

Circle's_Area ~ 0.05 sq m

When several variables are defined at the same time, and you display the value at the intermediate steps, then the order does matter ( top down ). The value returned is still based on the current value of all its parts when evaluated; which, in this case, is at definition. The second case below shows that even if the sub-variable "radius" is not yet defined you may use it as in an equation.
Circle's_Area: pi sq radius; ~ 7.30 sq m
Circle's_Area ~ 0.05 sq m

Circle's_Area: pi sq radius; *** ( 3.14 ( radius ^ 2 ) ) ***
Circle's_Area ~ 0.05 sq m

### How do variables differ from units? TOP

In most ways variables are used in the same way as units except:
• You can't use prefixes like mega, & kilo with variables.
• Plurals of variables are not recognized.
• Variables take precedence over existing units.

### What names can I use for variables? TOP

Variable names can be any length, but may not include any of the following characters &()*+,-./:;<=>^"~. In addition none of the following may be used as variables: as, coulomb, cu, cubic, cross, degC, degF, dot, inf, kg, per, pm, sq, square, to, \$, `i, `j, `k, °, °C, °F %. The following are also reserved: e, i, m, s, but E, I, M, S can be variable names. For example all the following are OK:

Water's_Density: gram/cc;
length: 20 cm;
width: foot;
height: 22 inches;
volume: length * width * height;
mass: volume * Water's_Density ~ 75.099 lb

### Where can I find the defined variables? TOP

From the UnitMath window pull down the windows menu and select "Variables". This will open the "Variables" window where all the defined variables with definitions are shown in alphabetical order.

The check box on the bottom of the screen controls whether just the variable or the variable, and its definition, are pasted into the UnitMath window when you double click on a variable.

### How do I edit an existing variable? TOP

To change an existing variable, in the UnitMath window enter and evaluate the variable definition. The variables definition consists of the variables name followed by a colon : followed by the value for the variable.

It is often convenient to paste the current definition into the UnitMath window, change the definition as required and reevaluate the definition ( select the definition and tap the "=" button ). To paste the current definition open the "Variables" window tap the check box at the bottom of the screen until it says: "Paste name and definition", then double tap the variable you wish to edit.

### How do I delete an existing variable? TOP

There are two ways to delete variables.
• In the UnitMath window enter and evaluate the variable name followed by a colon : with no definition.
• From the "Variables" window select the variables to delete and from the "Options" menu select "Delete selected variables".

### Why do I get a "?" in the answer? TOP

The equation that you evaluated had at least one inexact variable used more than once. In this case UnitMath evaluates the equation as if the multiple instances are independent.
a: 1 to 4 to 8;
a/a ~ 1/8 ? to 1 to 8 ?

To understand where this range of values comes from consider the following cases:
The minimum where "a" can take on different values simultaneously is:
( a = 1 ) /(a = 8 ) = 1/8

The minimum where "a" can take on only one value at a time is:
( a = 1 )/(a = 1 ) = 1/1 = 1

The maximum where "a" can take on different values simultaneously is:
( a = 8 )/(a = 1 ) = 8/1 = 8

The maximum where "a" can take on only one value at a time is:
( a = 8 )/(a = 8 ) = 8/8 = 1

You will normally see "?" in the answer only when you abort the search for the extremes.