Step 1: Determine the definition of the variables.
There are four dynamic variables in the question, namely xx, yy, a and b.
First, notice that we do not name variables x and y. That is because these names are reserved and used by EVTG (see Step 3 below).
Second, we want to be able to use both positive and negative values for all of these variables. This is the first timethat we will do this, and this requires care - not in the calculations, but in their display.
Third, we do not want a and b to take the value 0.
Let a and b be whole numbers between -10 and 10 (excluding 0).
Let xx also be a whole number between -10 and 10 (including 0).
In order to make our answer true, the point (xx,yy) must satisfy the function. So, we define .
If we want, we can add a condition on the range of yy.
The predefined function range( ) has an interesting feature, namely "If the lower limit is less than zero, and the upper limit is greater than zero, and an increment is provided, then the value 0 will never be returned by the function.". So
Step 2: Determine the format of the variables.
The formats of a and b are special because they are coefficients.
The variable a is a 1st coefficient. This means that if a>0, we do not want a + sign to be displayed in front of the value of a. Also, if a=1 or if a=-1, we do not want a 1 to be displayed.
The variable b is a constant coefficient. This means that we need both the sign and the value.
The other type of coefficient is a middle coefficient or just coefficient. Here we need the sign but not the 1 to be displayed.
Display formats for signs and values
|
Format / Value |
+3 |
-3 |
+1 |
-1 |
|
General, Number |
3 |
-3 |
1 |
-1 |
|
1st coefficient |
3 |
-3 |
|
- |
|
Coefficient |
+3 |
-3 |
+ |
- |
|
Constant coefficient (not available as EVTG format) |
+3 |
-3 |
+1 |
-1 |
Unfortunately, EVTG has only two coefficient formats, namely "1st coefficient" and "coefficient". So we will need to create a display function for "constant coefficients" (Step 3).
Finally, the format of xx and yy are not a problem because they are displayed as point coordinates. We can leave them in "general" or "number" format.
Step 3: Create a display function for constant coefficients.
The display function for constant coefficients that we will define here will work for non-zero whole number coefficients. In a later chapter we will talk about how to extend this definition.
We define our variables in order, starting with the variable a.

Now we will work on the display function for b. It will require three steps.
1. Defining the Constant Coefficient (CC) function

Before we click on OK, let’s look at the different elements of this algorithm definition.
a. We have used Type: Variable (the default) and Type: Condition.
This is our first time using Type: Function. Functions are used inside other algorithm definitions to create variables, which we then insert into the text of our question. Only variables are inserted! Conditions, functions (and constants) are used to determine variables.
b. CC(x) is our Constant Coefficient function. In the third step we will see how to use this.
c. There are two EVP predefined functions used here, the if( ) and the str( ) function.
Suppose that the argument is x= 3. Then, x>0 and the if condition is true and returns the string value of +, which is concatenated to the string value of x, which is 3 and CC(3)= +3.
Analogously, if x= -3, then the if condition is false and returns the empty string , which is then concatenated to the string value of x, which is -3 and CC(x)= -3 .
Notice that CC(x) is a string not a numeric value, so we cannot use it in any calculation.
2. We define the variable b, which we will use for any calculations.

3. Finally, we define the display variable for b. Remember, this is a string value and cannot be used for calculations. To help us remember this, we use Disp in the variable name.

We define the variables xx and yy. Note that we do not bother to make these variables unique as we have made our linear function unique (a and b are unique).


Note that the definition of the variable yy is a purely mathematical expression. That is, we are interested only in getting the correct value for yy.
For the moment we are done with the Edit Algorithm Definitions box.
Step 4: Type in the question.
First we will type in the question without using Equation Editor – just to check whether we defined our display function correctly. Then we will show how to use EE to give our question an even more professional look.

Here is our question. (As always, your values will likely be different.)

Step 5: Use Equation Editor.
We will rewrite the function using EE.
Your cursor should be one blank space after the word function. We are ready to insert an equation.

The EE dialog box will open.

Notice how y is automatically italicized (as variables should be). Notice that EE automatically puts a half-space between y and =. EE will take care of all of the spacing and italicizing automatically.
The Insert Variable dialog box with our list of variables will open.
Again, the Insert Variable dialog box with our list of variables will open.
(Remember, the sign between x and b is contained in Dispb.)
Here is how your function should look:

Here is how your question should look:

Here is our same question with the function written with EE.

Compare the readability and polish of this function with the one we wrote in Step 4. Click on the Calculate Values button several times to see how the function adapts to positive and negative values. As we can see, it is easy to use EE, and the results are worth it.
Step 6: Save the file.
|
|
You are now at a parking place. If you wish, you can exit EVTG. When you wish to continue, restart EVTG and open your question bank. (For information about how to do this see Chapter I, Part H or Part I.) |