CDC Community

🔹 Historical Conservation 🔹

User Tools

Site Tools


Numerical and Algebraic Judging: -ansv- and -wrongv-

We have already had some experience in handling numerical and algebraic responses by using -store- to evaluate numerically the student's expression. The -ansv- (for “answer is variable”) and -wrongv- judging commands evaluate the student's expression in the same way as -storeand also perform a comparison with a specified value.

The -ansv- command is useful in association with -store-. If you ask the student for a chapter number or a launch velocity of a moon rocket, it is convenient to use -ansv- to check whether his number is within the range you allow. For example:

. . . arrow 1314 store chapter ansv 5,4 $$ match if in the range 5±4 (1 to 9) no write Choose a chapter from 1 to 9. . . .

Another common use is in arithmetic drills:

define b=v1,c=v2 unit drill $$ multiplication drill next drill randu b,10 $$ pick an integer from 1 to 10 randu c,10 $$ pick another integer at 1513 write What is âs,bâ times ⦓x,c⦔? arrow 1715 ansv bxc $$ no tolerance write Right! wrongv b+c write You added. wrongv b×c,20% $$ plus or minus 20% write You are off by 1. wrongv b×c,20% $$ plus or minus 20% write You are fairly close. no write You are way off!

The drill as written will run forever. It could be modified to stop after 5 straight correct responses, or after some other criterion has been met. Note that the response “be” or “bxc is judged “no” (unless you define these variables in the “student” set of defines). Also note that the student need not do any mental multiplication for this drill (since if the student is asked to multiply 7 times 9, he or she could respond with 7×9 which matches the -ansv-).

Let's make a change to require some multiplication on the part of the student:

. . . ansv bxc judge opcnt=0,ok,wrong writec opcnt=0,Right!,Multiply! wrongv b+c . . .

Do not define “opcnt”! It is a system variable which counts the number of operations in the student's response. If the student says “7(5+8+3)/2” then “opcnt” will be 4 because the student's expression contains:

  1. an (implied) multiplication (7 times a parenthesized expression);
  2. two additions; and
  3. a division.

In this drill we want the student to give the result with no operations, so “opcnt” should be zero (“specs noops,novars” can also be used to prevent the student from using operations or variables in his or her response).

Recall that the first -concept- command encountered will trigger the reduction of the student's response to a compact form, through the use of the -vocabs-. This compact form can be compared rapidly to all succeeding -concept- commands. Similarly, the first -store- or -ansv- or -wrongvcauses TUTOR to “compile” the student's expression into a form which can be quickly evaluated when another of these commands is encountered. It is during the compilation process that “opcnt” is set. Just as the -vocabs- list tells TUTOR how to interpret the student's words, so the “define student” set of names tells TUTOR how to treat names encountered in the compilation of a student's algebraic response. So, there are many parallels between -ansv- and “define student” on the one hand and -concept- and -vocabs- on the other.

Let's look at an algebraic example, as opposed to the numerical examples we have treated:

define student x=v1 unit simplify at 1215 write Simplify the expression 3x + 7 + 2x - 5 randu x $$ pick a fraction between 0 and 1 calc x⇐x+1 $$ change to 1 to 2 range arrow 1418 ansv 5x+2 $$ 0 tolerance goto varcnt-1,toofew,x,manyvar $$ how many x's goto opcnt-2,toofew,x,manyop $$ how many operations wrongv 5x+12 write You should subtract 5, not add it. no goto formok,x,tellerr * unit toofew write Your expression is not sufficiently general. judge wrong * unit manyvar write "x" should appear only once. judge wrong * unit manyop write Not simplest form. judge wrong

Unit “tcllerr” would contain a -writec- involving the system variable “formok” to tell the student precisely why his or her expression could not be evaluated. There could be several -wrongv- statements in the example to check for specific errors. The system variable “varcnt” during compilation of the student's expression counts the number of references to variables. For example, “x +3x +x +2” is numerically equivalent to (5x+2), so that this response will match the -ansv-, but “varcnt” will be 3 because “x” is mentioned three times. If both x and y were defined, the expression “2x+y +4x” would yield a “varcnt” of 3 (two x's and one y) and an “opcnt” of 4 (two implied multiplications and two additions).

In this way “opcnt” and “varcnt” may be used to distinguish among equivalent algebraic responses which differ only in form. Roughly speaking, what is usually called “simplest algebraic form” often corresponds to the smallest possible values of “opcnt” and “varcnt”.

There are some minor technical points in the preceding example. For example, -randu- with only one argument produces a fraction between 0 and 1. If this should happen to be very close to 0 then “x” would be unimportant in the expression (5x +2), so it seems better to add one and give “x” a value between 1 and 2, which is comparable to the other quantities in the expression. We could have used the two-argument form (e.g., “randu x,8”) to pick an integer value for “x”. However suppose TUTOR chooses the integer 2 for “x”. In this case, a student who happens to give “12” as his or her response will match the -ansv- by accident since 5x+2 = 5 x 2 +2 = 10+2 = 12. On the other hand, with TUTOR picking a fraction, the student would have to type something like “8.93172462173” to accidentally match the -ansv-. This just won't happen. You would have to type different numbers 24 hours a day for hundreds of years to match accidentally. If you want even more security against an accidental match, just change the value of “x” and check again. In skeleton form, here is a way to do it:

. . . ansv 5x+2 goto varcnt-1,toofew,x,manyvar goto opcnt-2,toofew,checkup,manyop wrongv 5x+12 . . unit checkup randu x $$ new value of x calc x⇐x+1 judge continue ansv 5x+2 $$ try again . . .

A further check is that we require exactly one “x” and exactly two operations.

There is a way to give detailed feedback to the student in case his or her expression is not algebraically equivalent to the desired expression (5x+2). Suppose the student's incorrect expression is “6x+2”, and that you have done a -storea- to save the response and a -store- to evaluate it for some integer value of x. Then ask the student this question:

. . . write What is the numerical value of 3(⦓s,x⦔)+7+2(⦓s,x⦔)-5?

f x is 4, this will appear on the screen as:

What is the numerical value of 3(4)+7+2(4)-5?

Many students can handle a numerical example even if an algebraic example gives them trouble, so this student is likely to reply correctly, either with or without some help, that this expression gives 22. You can then reply to the student with this statement (assuming the student's alphanumeric response is in “string” and its value is in “result”):

write But your expression, ⦓a,string,count⦔, gives ⦓s,result⦔ in this case.

The student now sees that his or her expression “6x+2” does not give the value 22 which it should in the case where x is 4. You have fed back the student's own expression, evaluated for a particular case where the student can see there is a conflict. (In other words, anything the student says may be used against him or her.) Here is an opportunity for the student to learn, by example, a useful technique in simplifying complicated expressions: try some numerical cases for which you know the results and see whether they agree with the simplified expression.

It is possible to judge equations as well as expressions. Suppose we ask the student to simplify the equation “4x+3=x+12y-5”. A suitable response might be “12y=3x+8” or “x=(12y-8)/3”. Every time the student enters a response, let TUTOR pick a random value for the independent variable x, and calculate the corresponding value of the dependent variable y: y⇐(3x+8)/12. Consequently, any correct equation will be true (with value -1), and an incorrect equation will be false (with value 0). Here is a unit embodying these concepts:

define student,x=v1,y=v2 unit equate arrow 1718 ok randu x $$ random x on each judging calc x⇐x+1 y⇐(3x+8)/12 $$ y depends on x judge continue ansv -1 $$ logical true do ident wrongv 0 $$ logical false write That is false. no $$ anything else write Give me an equation! unit ident calc y⇐3.72y $$ change y arbitrarily judge continue wrongv -1 $$ should not now be true write That is an identity! ok judge varcnt>2,wrong,ok writec varcnt>2,Not simplified.,Fine.

If the student writes “3+4”, this expression has the numerical value 7, so the reply is “Give me an equation!”

If the student writes “3=4”, this expression has the numerical value 0, since it is logically false, and the reply is “That is false.”

If the student writes “32+5=17-3”, which is equivalent to 14=14, TUTOR replies “That is an identity!” The student's response is true (14 does equal 14), so that this true relationship has the value -1 which matches the -ansv- statement. A “do ident” follows, where the dependent variable y is changed so that y no longer bears the correct relationship to x. If the student's response had been a correct simplification of the given equation, his or her expression would no longer be true (-1), since y is no longer the correct function of x. In the case of “32+5=17-3”, however, changing y has no effect and the value is still -1, which matches the -wrongv- statement in unit “ident”. The student gets the message “That is an identity!”

Only if the student enters an equation which is not an identity will he or she get an “ok” judgment. Note the check on “varcnt”. There could also be a check on “opcnt”.

To summarize, -ansv- and -wrongv- are extremely powerful commands for algebraic or numeric responses, particularly in association with variables defined in the “define student” set. The system variables “opcnt” and “varcnt” give you additional information about the form of the response.

CAUTION: Since TUTOR performs multiplications before divisions (unless parentheses intervene), a student response of “1/2x” is taken to mean “1/(2x)”, whereas the student might have in mind ”(1/2)x“. It is important to warn your students of this convention at the beginning of a lesson which uses algebraic judging. Scientific journals and most textbooks follow this same convention, but many students are unaware of this. Usually, printed materials use the forms x/2 or 1/2x or 1/2x . These forms avoid the ambiguities that arise from the slash (/) or quotient sign (÷) used on a single typewritten line. It is hoped that eventually TUTOR will make it easy for students to type fractions with the horizontal bar rather than with the slash or quotient sign. Until then, it is important to point out this convention to your students.

Handling Scientific Units: -ansu-, -wrongu-, and -storeu-

tutor/numerical_algebraic_judging.txt · Last modified: 2022/08/25 20:35 by