Handling Scientific Units: -ansu-, -wrongu-, and -storeu-
Suppose you want to ask the student for the density of mercury. A correct answer would be “13.6 grams/cm3”, but there are many equivalent ways to write the same thing. For example, the student might write “13.6×10-3kg/ (.01 meter)3” or “13.6 gm-cm-3”, and both of these responses are equivalent to “13.6 grams/cm3”. TUTOR provides a convenient way not only to judge such responses appropriately, but to give the student specific feedback if he or she makes specific errors (such as omitting the units or giving the right units but the wrong number).
The TUTOR scheme is based on the judging performed by human instructors when grading exam questions involving numbers and units. The instructor makes two separate checks, one for the numerical value and the other for the dimensionality of the units. The dimensionality of density is (mass)1 (length)-3, and it is the powers (1,-3) that we are interested in as well as the number 13.6. All of the equivalent correct responses listed above have a numerical value of 13.6 (in the gram-cm system of units) and a mass-length dimensionality of (1, -3). The -storeucommand (-store- with units) can be used to get the numerical part and the dimensionality if we define the units appropriately:
We will go to a unit “badnum”, “badmass”, or “badleng” (not shown here) if there is something wrong with number, mass, or length. The -storeu- command has two variables in its tag. The first variable will get the numerical part of the student's response, and the second (dimens(1) in this case) is the starting point for receiving the dimensional information. Here are some examples of what will end up in num, dimens(1), and dimens(2) for various student responses:
student response | num | dimens(1) | dimens (2) |
---|---|---|---|
13.6 grams/cm3 | 13.6 | 1 | -3 |
13.6 | 13.6 | 0 | 0 |
13.6 cm-gm2 | 13.6 | 2 | 1 |
13.6 kg/10cm | 1360 | 1 | -1 |
Notice (in the third example) that a minus sign preceding a unit name is taken as a dash meaning multiplication, not subtraction. Note in the last example that “kg” brings in a factor of 1000 relative to the basic unit (gm). Note also that, as usual, TUTOR does multiplication before doing division so that the “10 cm” is all in the denominator, with the result that we have (length)-1. Similarly, “1/2 kg” will be taken to mean 1/(2 kg), not (1/2) kg. As mentioned earlier, it is best to point out this matter to the student at the beginning of the lesson.
Like -store-, the -storeu- judging command will flip TUTOR to the regular state (with a “no” judgment) if it cannot evaluate the student's response. The system variable “formok” can be used in a -writec- to tell the student why his or her response can't be evaluated. One example characteristic of responses involving units is “5 grams + 3 cm”, which is absurd. You cannot add masses and lengths, and -storeu- will give up. On the other hand, the student can say “65 cm + 2 meter” and -storeu- will set num to 265, dimens(1) to 0 (no mass), and dimens(2) to 1. As another example, “cos(3cm)” is rejected, but “cos(3cm/meter)” is accepted. The argument of most functions must be dimensionless. (Exceptions are “abs” and “sgrt”.)
A related difficulty faces students unless they are specifically warned about “3+6 cm” being rejected by -storeu- (although it looks reasonable in context to the human eye). As far as -storeu- is concerned, however, the student is trying to add 3 “nothings” to 6 cm, and the units do not have the same dimensionality. For -storeu- this is as improper as “3 kg + 6 cm”. Unfortunately, until -storeu- and TUTOR become more sophisticated, it will be necessary to give explicit instructions to the students that:
- Multiplications are done before divisions (unless parentheses intervene), so that 1/2 kg does not mean (1/2) kg.
- Responses such as “3 + 6cm” must be written rather as “(3 +6)cm”.
Note that these rules also apply in scientific journals and almost all textbooks, but your students may not be consciously aware of these standard rules. Given only these standard conventions, -storeu- will correctly handle an enormous variety of student responses.
While -storeu- can be used to get the number and dimensionality, the -ansu- and -wrongu- commands are primarily used to check for specific cases. Let us modify our sample unit to use these commands, which are like -ansv- and -wrongv- except for checking for correct units:
The -ansu- will make a match only if the dimensionality is correct and the wrongu- checks for 13.6 (mass)0 (length)0, that is, no units given at all. The second -wrongu- looks for a number equal to (num), and finds it since it is the number the student gave (as determined by -storeu-). Therefore, this -wrongu- will match if the number is not 13.6 but the dimensionality is correct. The -wrongv-, unlike -wrongu-, is only concerned with the numerical element rather than the dimensionality. It is used here to check for responses such as “13.6 cm”.