Algorithmic Variables

The Algorithmic Variable tool allows authors to create, edit, and insert algorithmic variables ("algos") into Smartwork5 problems in order to create dynamically generated content. In Smartwork5, an algorithmic variable is a set of values where one value from the variable is randomly selected for each view of the problem. Values are words or numbers that are written by the author of the problem. This means that when an algo is placed in a problem, each student will see a different word or number in its place. Algos therefore assist in reducing student cheating because students each receive a slightly different problem based on the values loaded for their view.

Setting up the Algorithmic Variables

  1. Open up the Algorithm Editor by checking the box next to “Algorithm Editor.”  Please note that unchecking this box does not delete the Algos you created—it just hides the Algo editor from view in the Edit Question screen.

  1. Determine whether you want the system to use significant figures in calculations, or decimals in calculations. This setting affects Range and Equation variables only, and this topic this explored further in the “Creating Number Algos” section. Please note that selecting Significant Figures does not mean students will be graded on them.

 

  1. To add an algorithm, click on the + button in the upper-right-hand corner of the editor. Once this is done, the Configuration tab will accept edits. This is where you will start defining your algo.

The Algorithm Editor allows you to create String Algos and Number Algos. Both kinds can be displayed to the student in any text area of the question, including in modules where the answer options are text-based. The system recognizes String values as text only. Number values may be used with mathematical expressions to define other algos (of the Equation type), and they may be set as the answer to a Numeric Entry module.

String and Number Algos also fall into one of four different Algo types: List types, Range types, Equation types, and Constant types. String Algos are always List Types, but Number Algos may be any of the four subtypes.

List Types are values that are manually listed out by the author. List Types can either be String Algos or Number Algos.

Range Types allow you to tell the system to generate numbers for students within a specific interval. Range Types are always Number Algos.

Equation Types allow you to put existing numeric algorithmic variables into an equation and manipulate them mathematically. Equation Types are always Number Algos.

Constant Types allow you to define constants that can be used in Equation Algos and throughout the question text/module. Constant Types are always Number Algos.

Furthermore, Algos can be independent, or in other words, stand alone, or can be dependent on other Algos.

Inserting Algos into Questions

After you create your algos, you can insert them into the Question Text Section, the Hint, the Introduction, and the Part and Summary Solutions by doing the steps outlined below.  Furthermore, after creating your algos, you should always check to see that they are working correctly by inserting them into the question text.

  1. Insert the algo into the Question Text section, the Hint, the Introduction, or the Solution. The Algorithm button contains a picture of a diamond.

  1. When you insert the algo, a rectangle that says “Parameter” appears.

  1. Double-click on it to select which algorithmic variable you want to insert into the question. A popup window will appear. Select the algo you want to test from the dropdown menu and click “OK.”

  1. In the Question Text section, the word “Parameter” should be replaced by the algo’s name.

  1. Save the question. Click “Preview” to view the question as a student. One of the values from the algo list should replace the rectangle that says the algo’s name. A newly randomized value should appear each time you refresh the preview.

Creating List Algos

For List Algos, the system displays a random value taken from a list of items provided by the author.

Furthermore, all List Algos can be Independent, meaning they stand alone, or Dependent, meaning the value that the system generates is dependent on the value it generates for another algorithmic variable. We will discuss the differences between independent and dependent list algos in-depth in the “Creating Numeric Lists” section.

Creating String Algos

The values in String Algos can either be text, or numerals that the system does not evaluate mathematically. Furthermore, numbers entered into String Algos do not contribute to sig figs or decimal point calculations.

In order to create an Independent String Algo, do the following:

  1. In the configuration tab, type out the name of your variables. This name will identify the variable to the author in the Edit Question view. The student will never see the variable name.
  1. Under “Is this variable a String or a Number,” select “String.” Once “String” is selected, the system will auto-populate the selection for “Type.”
  2. Because we want this particular example to be independent, select “No” for “Is this variable DEPENDENT on others?” 

  1. Click on the “List Value” tab.
  1. Begin creating a list of values you want students to see when they open up the question.
  1. In the editable text field under “Enter the acceptable values as below,” type out one of the values.
  1. Using the Text Formatting Palette, format the text. From left to right, the Text Formatting Palette allows you to do the following:

i.Bold text

ii.Italicize text

iii.Underline text

iv.Insert a subscript

v.Insert a superscript

vi.Insert special characters

vii.Insert Mathematical Expressions using LaTeX

 

  1. Once you have finished editing the value, click the + button. This will add your value to the list of values that the system may show a student. All successfully uploaded values will appear in this table.

  1. Values added to the table will also appear as “values” in the list of algos included in the question.

  1. You may add as many values to the table as you wish, but check with your editor for best practices.
  1. To delete a value from the table, highlight the value you want to delete and click the “–“ button.

  1. To update the wording or formatting of an existing value, select the value you want to update. In the text editor, re-format or retype the value as desired. Once you make the changes, click “Update.” This will update the value in the table with the edits you just made.

8. Test that your algo is working correctly by inserting it into the Question Text section and previewing it in student mode. For an in-depth look at how to do this, please refer to the “Inserting Algos into Questions” section.

Numeric List Types

Unlike with String Algos, the system recognizes the numeric worth of the values in Numeric List Algos, as well as all Number Algos. This allows the system to perform mathematical calculations with the values.

Numeric List values will always be displayed to the student exactly as you input them. The algorithm editor’s settings for significant figures or decimal places only come into play when Numeric List values are used as inputs into Equation Algos.

As mentioned earlier, all List Algos, including String Algos, can be independent or dependent.

Independent Numeric List Types

To create an Independent Numeric List Algo, do the following:

  1. In the Configuration tab, name your algorithmic variable.
  1. Under “Is this variable a String or a Number,” select “Number.” Under “Select a type” select “List.” For this example, under “Is this variable DEPENDENT on others?” select “No.”

  1. Go to the List Value Tab. Begin adding numbers to the table. For an in depth look at how to add values to a table, please refer to steps 4-7 in Creating String (Text) Algos. However, please note the following differences:
  1. For Numeric List types, the editable text field under “Enter the acceptable values as below” only accepts numerals in the form of whole numbers, decimals, and numbers in scientific notation. For scientific notation, the system uses E notation---for example, to insert 2 x 1015, you must type 2E15. This value will still display to the student as 2 x 1015.
  1. When creating variables for Numeric List Types, there is no Text Formatting Palette in the editable text field.

  1. Check that the algo is working correctly by inserting it into the Question Text section and previewing it as a student. For an in-depth look at how to do this, please refer to “Inserting Algos into Questions.”

Dependent List Types

List types can also be dependent on what the system generates for other list values. Any list variable can be made dependent on any other list variable. This means that a Numeric List Variable can be dependent on a Sting Variable, a String Variable can be dependent on another String Variable, etc.

To create a dependent, Numeric List Algo, do the following:

  1. In the Configuration tab, name your algorithmic variable.
  1. Under “Is this variable a String or a Number, select “Number.” Under “Select a type” select “List.” For this example, under “Is this variable DEPENDENT on others?” select “Yes.”

  1. In the List Value Tab, select the name of the algo you want your dependent List Algo to depend on. For the purposes of this demonstration, we will refer to the algo you select here as the “independent algo.” The dropdown menu will auto-populate with all the Numeric List values and String (list) values you already created for the problem. The independent values will then auto-populate in the right hand column of the value table.

  1. In the table, click on the row with the independent value you want your dependent value to depend upon. Every time this independent value is generated, this particular dependent value will also be generated.
  1. In the text field underneath “Select an index, enter a value, and click ‘Update,’” enter in your dependent value. When you are finished, click “Update.” Your dependent value will be in the left hand column of the value table. Your dependent value will always correspond to the independent value that is in the same row.

  1. Continue creating dependent values.
  1. Make sure you create as many dependent values as there are independent values. The system will not prevent you from creating fewer dependent values than there are independent values. However, in instances where no dependent value is specified, the system will not generate a value. This means that some of your students will be presented with a broken question.
  1. You may edit existing dependent values in the table by highlighting the row of the value you want to change, editing the value in the text field, and clicking “Update.”
  1. Check that the algo is working correctly by inserting it into the Question Text section and previewing it as a student. For an in-depth look at how to insert an algo into a question, please refer to “Inserting Algos into Questions.”

6. Once you have previewed the algorithm as a student, confirm that the system is producing the correct variable by checking the table in the List Value tab of the Algorithm Editor.

Range Algos

Range Algos allow you to tell the system to generate numbers for students within a specific interval. Range Algos are a subset of numeric types, so they will always be evaluated mathematically.

To create a Numeric Range Algorithm, do the following:

  1. At the top of the Algorithm Editor, select how you want the system to display the algorithmic variable to students. It can do this by using significant figures, or by displaying the number to a certain number of decimal places. Please note that selecting significant figures only affects the way the system uses these values in calculations and how the solution is displayed. It does not affect how the system grades students’ answers.

For significant figures, we use standard significant figure rules, which are explained here: http://en.wikipedia.org/wiki/Significance_arithmetic

Note: Currently, Range values are not displaying to students to the correct number of Significant Figures. Please contact your editor for further instructions.

In the Configuration tab, name your algorithmic variable.

  1. Under “Is this variable a String or a Number,” select “Number.” Under “Select a type” select “Range.” Range variables are never dependent on others, so that setting will automatically be defined.

  1. Go to the Acceptable Range tab.
  1. Enter the minimum value and the maximum value of your range.
  1. You may input any number, positive or negative, in these fields, including decimals. For decimals, please include leading zeros.  
  1. If you are using Significant Figures, it is good practice to make sure your minimum, maximum, and increase values contain the same number of sig figs. If they’re different, the system will display your range value to the lowest number of significant figures used. So, for example, if your minimum value contains three sig figs, and your max value contains eight sig figs, the system will display to three sig figs.
  1. If you are using Significant Figures, use “E” to write numbers in scientific notation. For example, if you wanted to write 5.25 x 1055, type out “5.25E55” in the editable text field. This will display as 5.25 x 1055 in student view.
  1. If you are using Decimals, please note that in a Range algo, any value inputted using Scientific Notation will always display as a decimal. For example, if you insert 5E4 in one of the range fields while decimal places is selected, the value will be displayed as 50000.0000 in student view. Therefore, if you want the system to display your values in scientific notation, you should set your algos to Significant Figures.
  1. Enter the interval by which you want the variables to increase within your range. For example, if your range is 2.0-20.0 and if you input 2.0 in the “Increase by” section, the system will randomly generate one of the following values: 4.0, 6.0, 8.0, 10.0, … 20.0. The same stipulations for Significant Figures and Decimals that apply to the minimum and maximum sections also apply to the “Increase by” section.

 

  1. Test your algo by inserting it into the Question Text section and previewing it as a student. For in-depth instructions on how to do this, please refer to “Inserting Algos into Questions.”

Equation Algos

Equation Algos allow you to put existing numeric algorithmic variables into an equation and manipulate them mathematically. Equation Algos are a subset of Numeric Algos.

To create a Numeric, Equation Algorithm, do the following:

  1. At the top of the Algorithm Editor, select whether you want the system to use significant figures or decimals in calculations. This will affect how the Equation algorithm displays the completed calculation to students. Please note that selecting significant figures affects the way the system uses these values in calculations, and the way it displays the values. It does not affect how the system grades students’ answers.

Furthermore, the number of significant figures you use in your equation affects the way the the system calculates your equation. As a rule, the system always calculates to the least number of significant figures; this includes numbers used within the calculations. So, for example, if you multiply a number by "2" while writing the equation algo, the system will calculate your equation algo to one significant figure because you use a number with one significant figure in the equation. 

Again, for significant figures, we use standard significant figure rules, which are explained here: http://en.wikipedia.org/wiki/Significance_arithmetic

Note: Currently, Equation algos are not displaying to students to the correct number of Significant Figures. Please contact your editor for further instructions.

  1. In the Configuration tab, name your variable.
  1.  Under “Is this variable a Sting or a Number,” select “Number.” Under “Select a type,” select “Equation.” Once “Equation” is selected, the system will auto-populate the selections for the variable’s dependency. Because Equation types mathematically manipulate existing algorithms, they will always be dependent on others. You cannot manually override this selection.

  1.  Click on the Equation tab.
  1.  Begin building your equation in the editable text field.
  1. You may build your equation by typing the following symbols:

i.Addition: +

ii.Subtraction: -

iii.Multiplication: *

iv.Division: /

v.Parenthesis: ( )

  1. You may also use the pre-programed math functions in the “Math Functions” drop-down menu. The pre-programmed Math Functions are:

i.Exponents: pow(a, b)  = a^b

ii.Square roots: sqrt(2) or pow(a,1/2) = a^1/2

iii.Cube roots: pow(a,1/3)

iv.Fourth roots: pow(a,1/4)

v.Absolute value: abs(x) = |x|

vi.Log: log(a, b) = the logarithm of a to the base b.

vii.Ln: ln(x) = the natural logarithm of x

viii.Exp: exp(x) = natural exponential function ex

ix.Sin: sin(x)

x.Cos: cos(x)

xi.Tan: tan(x)

xii.Arc sine: asin(x)

xiii.Arc cosine: acos(x)

xiv.Arc Tangent: atan(x)

c. Please note that SW5 doesn't support omitted multiplication signs. An expression such as 3exp(a) must be entered as 3*exp(a)

d. You can use the subtraction symbol to create a negative value.

  1. Add the algorithmic variable(s) you would like to manipulate mathematically by inserting it into the equation via the “Algo” drop-down menu. This dropdown menu will pre-populate with all of the Numeric Algos you created for this question.

  1. You can type numbers directly into the equation. If significant figure rules are being applied, the number of sig figs in these directly input numbers will help determine the result of the equation. For example, the term “1/x” will be computed to one significant figure. If the algo x has three sig figs, and you want the equation to also result in three sig figs, type in “1.00/x” instead.
  2. Test your equation algo by inserting it into the Question Text section and previewing it as a student. For in-depth instructions on how to do this, please refer to “Inserting Algos into Questions.”

Constant Algos

Constant Algorithms allow you to define constants that can be used in Equation Algorithms and throughout the question text/module.

To create a Constant Algorithm, do the following:

  1. In the Configuration tab, name your constant algorithmic variable.
  1. Under “Is this variable a String or a Number,” select “Number.” Under “Select a type,” select “Constant.” Once “Constant” is selected, the system will auto-populate the selections for the algo’s dependency. Constant types are always independent algos. You cannot manually override this selection.
  1. In the Configuration tab, type out the value of your constant algo.
  1. You may input any number, positive or negative, in these fields, including decimals. For decimals, please include leading zeros.
  2. Constant values will always be displayed to the student exactly as you input them. The algorithm editor’s settings for significant figures or decimal places only come into play when Constant values are used an inputs into Equation Algos.
  1. Use “E” to write numbers in scientific notation. For example, if you wanted to write 6.022 x 1023, type out “6.022E23” in the editable text field. This will display as 6.022 x 1023 in student view. Unlike Equation and Range types, constants will display in scientific notation regardless of whether you are using Significant Figures in calculations, or Decimals. However, if you are using scientific notation throughout your equation, it is usually good practice to tell the system to use Significant Figures. Check with your editor for best practices.

  1. Test that your algo is working correctly by inserting it into the Question Text section and previewing it as a student. For in-depth instructions on how to do this, please refer to “Inserting Algos into Questions.”

Using Algos in Questions

You can insert Algorithms in all fields of the question editor, including the Introduction, the Question Text, the Hint Text, the Part Solution, and the Summary Solution.

Currently, you can insert algorithmic variables as answer choices in the following modules:

  • Multiple Choice
  • Multiple Select
  • Numeric Entry (Numeric Algos only)
  • Short Answer*
  • Labeling
  • Ranking
  • Sorting (both as a category and as an item)
  • Symbolic Equation

*While you technically can insert algorithmic variables into the Short Answer module, algos make it very difficult to use synonyms, which are variations of the coded answer that you can tell the system to recognize as correct. Furthermore, the Short Answer module allows authors to insert Numeric Algorithmic Variables as correct answers, instead of only String Variables. Therefore, we strongly encourage you to check with your editor for best practices before creating a Short Answer module that uses Algos.

You can also insert algorithmic variables into the feedback text of any module.

Sample Algo Question

Recreate the following Chemistry problem to practice building algorithmic variables and using them in questions. In recreating this question, use algorithms to give students (1) a range of initial values, and (2) at least three different Elements.

Question:

You have [Initial Value] particles/L of [Element] in an aqueous solution. What is this in g/L?

Objectives:

  • Build a Numeric Range Algorithmic Variable
  • Build a String Algorithmic Variable
  • Build a Dependent Numeric List Algorithmic Variable
  • Build a Numeric Constant Algorithmic Variable
  • Build a Numeric Equation Algorithmic Variable using the other algos, and trace how the system evaluates the other algos mathematically
  • Use Scientific Notation in Algorithmic Variables
  • Use Significant Figures in calculations

Collect and Organize:

  1. The purpose of this question is to have students convert particles/L of an Element to g/L. We would like to use algos to give students (a) a range of possible initial values to use in their calculations and (b) one of three possible Elements to convert.
  1. This problem will require students to give their answer in the form of a number, so Numeric Entry will be the most appropriate module to use when defining our answer.
  1. To give students a range of initial values to use in their calculations, we will need to create a Range Algo.
  1. To give students a variety of possible Elements, we will need to create a String Algo.
  1. Since students will each see a different number for the initial value, as well as a different Element, students will give a variety of correct answers. In order to account for every correct answer, we will need to create an Equation Algo to place in the correct answer tab of the Numeric Entry Module Editor.
  1. We can model our Equation Algo off of the math students will use to solve the problem. To solve the problem, students will have to use the following stoichiometric equation:

  1. To complete this Equation Algo, we will need to create a Constant Algo to account for Avogadro’s Number.
  1. We will also need to create a Dependent List Algo to account for the Molar Mass of the Element. This list algo is dependent because the molar mass that students will use in their calculations will depend on what Element they see in the question stem.

To summarize, we need to create the following Algos in order to write this problem successfully:

Algo Name

Algo Type

Initial Value

Range

Elements

String

Molar Mass

Dependent List (dependent on Elements Algo)

Avogadro’s Number

Constant

Final Answer

Equation

We may also want to create additional Equation algorithms to trap for specific incorrect answers. However, we will do that only after we create the values in the above table and set the correct answer.

Create:

  1. In the Question Text section of the Question Editor, type out your question stem, using placeholder text for your algos.
  1. Insert a Numeric Entry Module into the Question Text section. We will fill in the answer choices and feedback for this module once we create our Algos.

  1. Expand the Algo Editor. Tell the system to use significant figures in calculations. This will affect how the system calculates the Final Answer Algo.

  1. Create your Initial Value Algorithmic Variable. We want this to be a range value. For an in-depth look at how to do this, refer back to the Range Types section of this document.

  1. Create your Elements algorithmic variable. We want this to be a String value. For an in-depth look at how to do this, refer back to the String Types section of this document.

  1. Create your Molar Mass algorithmic variable. We want this to be a Numeric List Type that depends on the Elements algo. For an in-depth look at how to do this, refer back to the Dependent List Types section of this document.

  1. Create your algo for Avogadro’s Number. We want this to be a Constant Type. For an in-depth look at how to do this, refer back to the Constant Types section of this document.

  1. Create your Final Answer Algo using the algorithmic variables you just created. We want this to be an Equation Type. For an in-depth look at how to do this, refer to the Equation Type section of this document.

  1. Test that all of the algos you created are working properly by inserting them into the Question Text section of the document and hitting preview. Use this time to make sure the system is calculating the correct number of Significant Figures as well.

  1.  Go back to the Question Text section and replace your placeholder text with the appropriate algos.

  1.  In the Numeric Entry module, set the “Final Answer” algo as the Correct Answer. Create feedback for the correct answer, save the module, and test that the module is working correctly in Preview mode.

  1.  If desired, you can use algorithmic variables to trap for specific incorrect answers students may use. To do this, do the following:
  1. Determine what common mistake a student might make when solving this problem. In this example, we will pretend that a student multiplies by Avogadro’s Number instead of dividing by it.
  1. In the Algorithm Editor, create a new Equation Algo. Name it “IncorrectAns1.”
  1. In the Equation Tab of the Algo Editor, create an equation that represents this common student mistake. In this example, we are building “IncorrectAns1” with the existing algos; however, you can also create new algos to build other incorrect answers.

  1. In the Numeric Entry Module editor, insert this algo into an incorrect feedback tab. Create feedback around it.

  1. Save the module.
  1. Save the question and test your algo in preview mode.