6.23 Tutorial: Algorithmic Question - Maple T.A. 2016 Help
Maple T.A. Online Help

Instructor
Search Maple T.A. 2016 Help:

6.23 Tutorial: Algorithmic Question

Algorithmically generated variables are used in questions to generate random numbers in questions and create multiple permutations of questions from a single template. The system uses a special field (algorithm) to contain variable definitions. Variable definitions must be presented in the proper system syntax. They can contain embedded functions and arguments.

Note: For any question type, you can use Maple commands and Maple T.A. to generate algorithmic numbers. For more information, see Tutorial: Maple-based Algorithmic Question Authoring

This tutorial examines the process of converting a typical numeric question to an algorithmically generated question by using variables.

Consider a single example. Substitute variable data for the mass and speed values in the following question each time the assignment is generated.

A ball of mass 0.8 kg is thrown at a speed of 12.6 m/s. (a) What is its momentum? (b) What is its kinetic energy?

The plain-text script for this question with no algorithms is:


qu.1.1.mode=Multipart Formula@
qu.1.1.question=
A ball of mass 0.8 kg is thrown at a speed of 12 m/s.
<br>(a) What is its momentum?
<br>(b) What is its kinetic energy?
@
qu.1.1.answer=
9.6 m/s; 46.08 J
@

The plain-text script for this question, created algorithmically, is:


qu.1.1.mode=Multipart Formula@
qu.1.1.algorithm=
  $m=decimal(1,rand(0.5,  1.0));
  $v=decimal(0,rand(10,  15));
  $ansa=decimal(2,($m*$v));
  $ansb=decimal(2,(1/2)*$m*$v^2);
  @
qu.1.1.question=
A ball of mass $m kg is thrown at a speed of $v m/s.
<br>(a) What is its momentum?
<br>(b) What is its kinetic energy? @
qu.1.1.answer= $ansa; $ansb@
qu.1.1.comment=
  $ansa kg m/s is its momentum.<br>
  $ansb J is its kinetic energy.
  @

Note that the algorithm field and variable definitions have been added.

  • The variables are represented by alphanumeric names that must start with a $ followed by an alphanumeric sequence that consists of at least one letter.
  • The first character in the name of the variable must be a letter (not a number).
  • Variables are defined in a series of statements resembling equations of the form:

$variable=<formula>;
 
  • Each variable definition is separated by a semicolon (the final semicolon in a series of variable definitions is optional).
  • The syntax of the formula is similar to the standard graphing calculator syntax used throughout by the system, with the addition of some new functions.

In this question, the randomized variables are mass, $m, which varies between 0.5 and 1.0 and velocity, $v, which varies between 10 and 15. The decimal argument is used to truncate the values of the numeric variable data.

The answer field holds two statements, one corresponding to each part of this multipart formula question. Statements in the answer field are evaluated by the system grader, so must be expressed using proper math syntax. Also, note that in this question we use the comment field to display the computed value of the answer rather than answer definition (Displaying Answers).

See Also:

Overview of Algorithmic Question Capabilities