Example: Use algorithmic values in an economics question
Updated 28 Aug 2023
This example guides you through the steps needed to create a question that calculates the future value of a sum deposited in a bank account.
To begin, design your question and its algorithms on paper. Start with the static question and then convert the values to algorithmic.
Static question:
Calculate the future value of a deposit of $5000 compounded annually at an interest rate of 7% over 20 years.
The solution is 5000 * (1.0 + (7/100.0))^20
Algorithmic question:
Calculate the future value of a deposit of $PV compounded annually at an interest rate of R% over N years.
Future Value is PV * (1.0 + (R/100.0))^N
The algorithmic values are defined in the following table:
Value | Type | Constraints | Notes |
---|---|---|---|
PV | Integer | =(1000,5000,10000) | Present value of account |
R | Integer | >=2, <=10 | Rate of interest |
N | Integer | >=1, <=30 | Term of investment |
FV | Decimal | ~PV*(1.0+(R/100.0))^N | Future value of account |
Now that you have designed the question and the algorithms, you are ready to create a new question and enter the algorithms:
- Open the Custom Question Builder.
- In the Create Custom Question wizard, select Start with an empty template and click Next.
- In the Choose Layout window, select Full screen, and then click Next to open the Custom Question Builder with a blank problem.
- Click Show Algorithmic Values List to open the Algorithmic Values List window.
You use the Algorithmic Values List window with the Edit Algorithmic Values window to create the algorithmic values that you have defined. Use the table you created in the first section to help you enter the values.
To enter your algorithmic values:
- Click Add to bring up the Edit Algorithmic Values window, where you can enter your algorithmic values.
- Using the table of values, enter the value PV and its constraints:
- In the Algorithmic Value Name box, replace the default name
V1
withPV
. - In the Select Type of Algorithmic Value section, select Integer.
- In the List Values or Set Up Constraints section, select = from the Relational Operator dropdown list for the first constraint.
- In the Constraint Value box, enter
1000
as the constraint value. - For the second constraint, select = from the Relational Operator dropdown list and enter
5000
as the constraint value. - For the third constraint, select = from the Relational Operator dropdown list, and enter
10000
as the constraint value. - Click the Options tab and in the Authoring Notes box, enter the note:
Present value of account
. - Click Save to enter your value in the Algorithmic Values List. Your entry looks like this:
- In the Algorithmic Value Name box, replace the default name
- Click Add and enter the value R and its constraints:
- In the Algorithmic Value Name box, replace the default name with
R
. - In the Select Type of Algorithmic Value section, select Integer.
- In the List Values or Set Up Constraints section, select >= from the Relational Operator dropdown list for the first constraint.
- In the Constraint Value box, enter
2
. - For the second constraint, select <= from the Relational Operator dropdown list, and enter
10
. - Click the Options tab and in the Authoring Notes box, enter the note:
Rate of interest
. - Click Save.
- In the Algorithmic Value Name box, replace the default name with
- Because R and N are similarly defined, you can duplicate R and edit the algorithmic values to define N:
- Make sure your cursor is in the row for the algorithmic value R and then click Duplicate.
- Click Edit at the beginning of the row of the new algorithmic value to bring up the Edit Algorithmic Value window.
- In the Algorithmic Value Name box, replace the default name
V1
withN
. - In the List Values or Set Up Constraints section, replace the value
2
with1
and the value10
with30
in the Constraint Value column. - Click the Options tab, delete the notes already in the Authoring Notes box and enter the note:
Term of investment
. - Click Save to enter your value in the Algorithmic Values List. Your entries look like this:
The entries in the Value column of your version of the question might vary from this example because they are algorithmically generated.
- Click Add to enter the remaining value FV and its constraints:
- In the Algorithmic Value Name box, replace the default name
V1
withFV
. - In the Select Type of Algorithmic Value section, select Decimal.
- In the List Values or Set Up Constraints section, select = from the Relational Operator dropdown list for the first constraint.
- In the Constraint Value box, enter the formula:
~PV* (1.0 + (~R/100.0))^~N
. Be sure to precede algorithmic value names with a ~ (tilde), such as ~PV. - In the Format section, select Show trailing zeros and Use commas or spaces between periods. Also choose the number of decimal places.
- Click the Options tab, delete the notes already in the Authoring Notes box and enter the note:
Future value of account
. - Click Save to enter your value in the Algorithmic Values List. When you finish, your Algorithmic Values List looks like this:
The entries in the Value column of your version of the question might vary from this example because they are algorithmically generated.
- In the Algorithmic Value Name box, replace the default name
- Click Close in the Algorithmic Values List window to return to your question.
First enter your problem statement and then the answer.
Entering the problem statement
To enter the problem statement (question):
- Remove the placeholder text and type the problem statement:
Calculate the future value of a deposit of $
- Click the Algorithmic Values button in the left menu to view a list of algorithmic variables and their current values.
- Select the entry for PV.
The current value of PV is inserted in the problem statement highlighted in lavender to show that it's algorithmic. If you click Show Algorithmic Value Names in the Algorithmic Values toolbar, the algorithmic value name now shows instead of the current value. You can toggle between the value and name by clicking this button.
- Add a space after the value you inserted and continue entering the problem statement:
compounded annually at an interest rate of
- Add a space, click Algorithmic Values, and select the entry for R to insert it in your question.
- Continue entering the problem statement:
% over
- Add a space, click Algorithmic Values, and select the entry for N to insert that value in your question.
- Add a space after the R value and finish entering your problem statement as follows:
year(s).
Entering the student interaction
To enter the student interaction (answer):
- On a new line, enter the answer text:
FV = $
- With your cursor at the end of the line, click Short Answer under Student Interactions in the left menu. This option opens the Edit Answer Definition window, where you define your answer.
- In the Edit Definition window, click on Step 1.
- Select Specify a subset of equivalent answers to accept, and then select Accept integer or decimal equivalents only. Click Next to go to Step 2.
- On the Define Answers page, click the first row under Value in the table. When your cursor is visible in the row, right-click and select Editing Options from the menu.
- Select Algorithmic Values from the menu.
- Select ~FV from the list of algorithmic values to insert it in the Value box. Click Next to go to Step 3.
- Under Numeric Comparison, enter
0.005
in the Tolerance +/- box. - Under Correct Answer Format, specify
2
for the Number of decimal places and check Show trailing zeros. Leave all other options as the default. Click Next to go to Step 4. - On the Edit Feedback page, enter this message in the Incorrect Feedback box:
Use this formula to calculate future value: presentVal *(1.0+(intRate/100.0))^term
- Click Save to close the Edit Answer Definition window.
- Add a space and then enter the following instructions in parentheses after the answer box:
(Enter your response rounded to the nearest penny.)
Highlight these instructions and click the italic icon () in the toolbar.
Your question looks something like this:
- Click Regenerate Values several times to verify that your algorithms work correctly.
- Click Preview Exercise and enter an incorrect answer.
- Check your answer to see the feedback message.
- Regenerate the question several times to make sure your algorithms work as intended.
You can regenerate the question by clicking Similar Exercise on the bottom right of your preview window.
- Close the Preview window.
- When you are sure that your question works correctly, click Save.
- Give the question a name and select Algorithmic as the format.
- Optionally add a textbook association and keywords.
- Click OK to save your question.
After you save your question, you can add it to an assignment.