Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Numerical question units and intervals

From MoodleDocs

This is my proposal for how the numerical question function and interface should be improved. [_] means checkboxes that teachers could use for specifying different question behaviours.

Allow evaluation of expressions

 Checking this would accept  5/2   0.5*5  5^2/10   5^(5-3)/10  25*10^-1  sqrt(25)/2
The main value of calculated or numerical question is that the student really does the 
calculation and gives a real number (which means in decimal format). 
I suggested that you use the short answer (or the multichoice) question type with the different
answer forms that you allow. 
Pierre Pichet 04:25, 6 September 2007 (CDT)
To me the real value of the numerical question type is it's ability to really see the 
answers as numbers and be able to see what things are equivalent. I have for many years
used a PERL script which could treat 3/2 and 1+1/2 and 1.5 and (1,5 for us Swedes) as 
the same thing, and especially to accept well defined intervals.
Often I am more interested in students knowing HOW to create the right expression moreso
than doing the last step, evaluating it. It is also interesting when looking at the 
statistics for a question, to see how they "thought" which can aid the teacher when 
adding new feedback for other answers.
Real numbers include rational numbers include 1/3 which cannot be correctly represented
as a decimal. (Which doesn't bother me as a physicist, but a pure matematician ought to
value being able to use expressions like 1/3. 
(Even if a programmer may say it'll only work from 0.33333333333333333333333333333 to
0.333333333333333333333334 :-))
Jeff Forssell 06:21, 6 September 2007 (CDT)
If your answers are necessarily expressed as rational numbers then the short answer type
is the way to do it. You could use as many answers as necessary to express the various
formats that you accept as correct.
Pierre Pichet 07:21, 6 September 2007 (CDT)
But that would mean that the teacher looses the possibility to give feedback for numerical
intervals. Having questions that are as open as possible for different kinds of answers
while still being able to give meaningful feedback is one of the strengths of Moodle that
I like and would like to increase!Jeff Forssell 07:01, 4 October 2007 (CDT)

5/2 0.5*5 5^2/2 5^(5-3)/2 25*10^-1 sqrt(25)/2 These value are not the same 5^2/2 and 5^(5-3)/2 are equal to 12.5! I think it is very difficult to define which expressions are to be accepted. The numerical answer should somehow be the result. Otherweise the answer to a question like sqrt(50-2*17)=? could be the question itself. Stefan Büchler 25. Jan. 08

I have for many years used a Perl script that worked very well with numerical questions. It had the ability to evaluate expressions also and compare the value with the intervals that gave various feedback. Usually I felt that it was a good possibility. A lot of times in physics the main problem is figuring out HOW to get the result and the the actual computation can be, easy though time consuming. (Also good if they weren't getting the right answer, I could see HOW they were figuring.) But sometimes I wanted to be able to turn it off, just because of the possibility of "the answer being the question". That's why I suggest that this possibility should not be the default, but something that a teacher can chose If s/he wants it. (thanks for the pointing out the unequal expressions, which I have {hopefully} corrected. Jeff Forssell 08:26, 22 September 2008 (CDT)

Allow fraction type 2 1/2 as 2.5

Translate "½" as "+.5" but give warning "Avoid ½ character in numerical expressions! We have translated ½ as +.5 to evaluate your answer."

 In the student question interface the answer box should:
 1) have an easy way to access with keyboard
    a) good "tab order": when opening a quiz question page the student will usually want to 
       answer the first question as his/her first option (tab order =10) 
           Assuming there are no other taborders set this would be first.
           "BASIC" numbering allows later refinements without renumbering. 
       if available "send in question" (tab order =15)
       answer next question (tab order= 20)
       if available "send in question" (tab order =25)
        (how this looks would depend on how many question blanks are on a page
         and would end up att NEXT page link)
    b) Acesskeys (This is mined territory since there are no real standards (or
           rather several DIFFERENT standards) It would probably be best to let 
           people chose whether they want this activated and maybe which keys for which targets)
  2) Have a (?) after the answer box linked to a popup explanation, which depends
     on which options were checked by question author, saying for example:
      This is for a numerical answer. The answer can contain a unit at the right 
      end after a space. As decimal character you may use . or , . Mixed fractions
      can be written as 2 1/2  which is interpretted as 2+1/2 (2½) In this question
      you may enter an expression which is evaluated to a number before comparing to
      the correction key. [link to examples of allowable expressions]    

Answer 1:[ 2.5 ] Accepted error ± [0.5] Grade: [100%] Feedback:


Answer 2: [ 100.4..100.5) ] Accepted error ± [_empty_] Grade: [90%]

 Which would be interpreted  110.4 <= right < 100.5
  i.e. the round parentheses would mean that boundary not included in intervall
 or that one could enter evaluation strings like
 110.4<=ans<100.5||100.5<ans<=100.6
 (I know that this particular thing can be addressed by having
 100.5 +/-0  first than 100.5 +/-0.1)

Feedback:

Answer 3: ...
Feedback: (for answer 3)	
Show 3 more alternative answer fields

Units mandatory or not

How the question has treated use of units

The actual philosophy of units in the question at present (-2008) is that the units are used to allow the student to answer the question in another unit than the one prescribed or implied by the question. However this unit must have been specified when creating the question.

This is why you set a multiplier to convert from your implied or expressed unit with a default 1 multiplier. For example, if you enter a unit of 'cm' here, and the accepted answer is 15, then the answers '15cm' and '15' are both accepted as correct. You can also specify a multiplier. So, if your main answer was 5500 with unit W, you can also add the unit kW with a multiplier of 0.001. This means that the answers '5500', '5500W' or '5.5kW' would all be marked correct. Note that the accepted error is also multiplied, so an allowed error of 100W would become an error of 0.1kW. For the response where the multiplier is 1 the unit is not mandatory.i.e.'5500', '5500W' However when the multiplier is not 1 then the units is mandatory. i.e. '5.5kW'

How most science/math teachers expect students to answer regarding units

Usually a numerical answer without a unit is not considered complete. (At least in Sweden and when I grew up in the states 1960s) If one has an automatic correction of numerical values only, one must sacrifice the openness of the question by stipulating units.

What Moodle's questions have often provided is the possibility of allowing quite open responses from the students and still it can give meaningful feedback and points. If we must say "your answer must be expressed in kilonewtons" we won't be able to discover the weaknesses that might have lead to the student thinking Joules. Knowing what unit is involved it an important part of the ability we try to teach the students and we must be able to evaluate it. That is not possible with the question's present way of functioning.

A student can answer "5.2" and gets full points without writing any unit whereas a student answering "52 millimeters" would get zero if no multiplier was stipulated OR the unit only expressed as "mm" or "millimeter". The student with the 5.2 answer might have even been thinking "m" rather than the the teacher's expected "cm". This would not be the case if it were a "paper" test/assignment.

Unit feedback options=

 differentiated unit feedback, which is all of:
          If there is no SPACE between the number and unit "There should always be a
               space between the number and the unit, except for degree sign ° and
 other planal angle units." 
          translate dimensionless "units": % = *0.01; ppm=*1E-6 ppb. promille   
          feedback for lacking unit [_]Feedback for accepted UNIT but wrong number 
          feedback for "possibly right number" if unit is adjusted
          feedback for "Unit not recognized, either misspelled, wrong type,
              or just not expected"
         (o) missed unit gives standard retry reduction of points (_)no reduction 
              for missed unit (_)this reduction [___]  
         [Unit rules and style conventions] (#17  I don't
          understand. Otherwise a good colection of rules, at least about SI units.
          #16 is a rule that could be good to be abe to choose to enforce.) 
 

Unit: [ ] (optional)

 Should accept arrays like kg, kilogram, kilograms , kilogramme, {"kilo gram", keelograhm} 
 where the ones enclosed in {} would be given feedback like
  We have interpretted keelograhm as a misspelling av kg Be aware that small spelling
   mistakes  like M in stead of m can lead to huge errors M=Mega=million
   m=milli= one thousandth" 

Alternative Units: Multiplier:[ ] Unit: [_______]

There should be the same possibility of unit arrays here.
Allow prefix units ($,£ maybe there are others )

The Multiplier should have an explanation (?)

  If the student answers with this unit, the student answer will be multiplied with this number 
  before being compared with the expected answer. Example:
  Answer [_10__] Unit [cm]
    alternative unit
    multiplier [_2.54_] unit [", in, in., inch] 
       (That " could be a tricky unit to handle!)

Then there are some things that I would be interested in having as options for all [maybe?] questiontypes (including numerical):

1) "Challenge" That a student is given (perhaps with a linked "!" or "Hmm.." or button) a chance to give his/her preferred answer and his/her motivation (or why they didn't understand, like, agree with the grade or feedback they got for their answer or how the question was phrased.) This might be implemented witn similar code to number 4 below.

2) Hints option: option to include a clickable link that could display a/some hint(s), if the student didn't know how to attack a question. (It is possible, though hardly for html-illiterate, to use the OverLib.js which is included in Moodle to do this even now.

3) Certainty (in the past sometimes called "confidence") declaration option

    [__answer___]  certainty: Hi(o)|Med( )|Low( )
    if possible with CBM/CBG grading scale including negative

4) All Internet pages (that the maintainer cares about) should have a feedback link something like this:

[Completely satisfied with this page?]