I'm in the process of adding in support for answers with scientific units into STACK.

I'm posting on the list to ask for help in the *design* of these features. I'm not asking for help writing code, I'll do that! What I do need is some advice from people who regularly teach mathematics with units. E.g. science and engineering.

I've posted a working prototype of the code in the branch "units". See https://github.com/maths/moodle-qtype_stack/tree/units

Those of you able to do so are welcome to test out this branch yourselves.

The support for adding units has been written by Matti Harjula in Aalto. Thanks Matti! This code is listed on https://github.com/maths/moodle-qtype_stack/blob/units/stack/maxima/stackunits.mac

The current basic behaviour, with some example feedback is shown below. I really could use a lot more test cases, particularly from physics and chemistry where there are a variety of units. Please email me with comments, and examples to C.J.Sangwin@ed.ac.uk.

This is an opportunity for people who will use this feature to influence the design. If you ask for something, you might even get it before the design is released and fixed!

Some questions

- Do you want a separate input type to enable answers without units, for example, to be rejected as invalid? Currently, student must use the algebraic input. If so, how should this work? E.g. no units=invalid, wrong units=valid.
- I've used the existing NumSigFigs test as the numerical test with which to check the numerical accuracy. Is this the right test to use? STACK has a number of numerical tests, so I chose this one.

The current plan is to test this over the next month, and then together with some other new features (including multiple choice inputs), release an incremental version at the end of January.

In parallel to this there are a number of other things going on, including "reasoning by equivalence" which I've mentioned before. I've been asked about support for scientific units for some time, so this seemed worthwhile releasing as an increment sooner.

Chris

## Sample input-output behavious

Passed? | Student response | Teacher answer | Options | CAS errors | Raw mark | Expected mark | Feedback | Answer note |
---|---|---|---|---|---|---|---|---|

Pass | x=12.3*m*s^(-1) | 12.3*m*s^(-1) | 3 | 0 | 0 | Your answer needs to be a number together with units. Do not use sets, lists, equations or matrices. | ATUnits_SA_not_expression. | |

Missing units | ||||||||

Pass | 12.3 | 12.3*m | 3 | 0 | 0 | Your answer must have units. | ATUnits_SA_no_units. | |

Pass | 12 | 12.3*m | 3 | 0 | 0 | Your answer must have units. | ATUnits_SA_no_units. | |

Pass | 1/2 | 12.3*m | 3 | 0 | 0 | Your answer must have units. | ATUnits_SA_no_units. | |

Pass | e^(1/2) | 12.3*m | 3 | 0 | 0 | Your answer must have units. | ATUnits_SA_no_units. | |

Expected failure | 9.81*m | 12.3 | 3 | TEST_FAILED | 0 | -1 | The answer test failed to execute correctly: please alert your teacher. | CASError: TEST_FAILED | ATUnits_SB_no_units. |

Bad units | ||||||||

Pass | 9.81+m/s | 9.81*m/s | 3 | 0 | 0 | Your answer must have units, and you must use multiplication to attach the units to a value, e.g. `3.2*m/s` . | ATUnits_SA_bad_units. | |

Basic tests | ||||||||

Pass | 12.3*m/s | 12.3*m/s | 3 | 1 | 1 | ATUnits_units_match. | ||

Pass | 12.4*m/s | 12.3*m/s | 3 | 0 | 0 | The accuracy of your answer is not correct. Either you have not rounded correctly, or you have rounded an intermediate answer which propagates an error. | ATNumSigFigs_Inaccurate. ATUnits_units_match. | |

Pass | 12.4*m/s | 12.3*m/s | [3,2] | 1 | 1 | ATUnits_units_match. | ||

Pass | 12.45*m/s | 12.3*m/s | [3,2] | 0 | 0 | Your answer contains the wrong number of significant digits. | ATNumSigFigs_WrongDigits. ATUnits_units_match. | |

Pass | 12*m/s | 12.3*m/s | 3 | 0 | 0 | The accuracy of your answer is not correct. Either you have not rounded correctly, or you have rounded an intermediate answer which propagates an error. | ATNumSigFigs_Inaccurate. ATUnits_units_match. | |

Pass | -9.81*m/s^2 | -9.81*m/s^2 | 3 | 1 | 1 | ATUnits_units_match. | ||

Pass | -9.81*m*s^(-2) | -9.81*m/s^2 | 3 | 1 | 1 | ATUnits_units_match. | ||

Pass | -9.82*m/s^2 | -9.81*m/s^2 | 3 | 0 | 0 | The accuracy of your answer is not correct. Either you have not rounded correctly, or you have rounded an intermediate answer which propagates an error. | ATNumSigFigs_Inaccurate. ATUnits_units_match. | |

Pass | -9.81*m*s^(-2) | -9.81*m/s^2 | 3 | 1 | 1 | ATUnits_units_match. | ||

Pass | -9.81*m/s | -9.81*m/s^2 | 3 | 0 | 0 | Your units are incompatible with those used by the teacher. Please check your units carefully. | ATUnits_incompatible_units. ATUnits_correct_numerical. | |

Pass | 9.81*m/s^2 | -9.81*m/s^2 | 3 | 0 | 0 | Your answer has the wrong algebraic sign. | ATNumSigFigs_WrongSign. ATUnits_units_match. | |

Pass | 9.81*m/s | -9.81*m/s^2 | 3 | 0 | 0 | Your answer has the wrong algebraic sign. Your units are incompatible with those used by the teacher. | ATNumSigFigs_WrongSign. ATUnits_incompatible_units. | |

Different units | ||||||||

Pass | 25*g | 0.025*kg | 2 | 1 | 1 | Your units are different from those used by the teacher, but are compatible with them. Numerical values are being converted to SI base units for comparison. | ATUnits_compatible_units. | |

Pass | 26*g | 0.025*kg | 2 | 0 | 0 | The accuracy of your answer is not correct. Either you have not rounded correctly, or you have rounded an intermediate answer which propagates an error.Your units are different from those used by the teacher, but are compatible with them. Numerical values are being converted to SI base units for comparison. | ATNumSigFigs_Inaccurate. ATUnits_compatible_units. | |

Pass | 0.025*g | 0.025*kg | 2 | 0 | 0 | Please check your units carefully. | ATUnits_compatible_units. ATUnits_correct_numerical. |