# Computer based training on creating algebraic expressions

(I write this post in English, since I would like it to be accessible to non-Swedish readers. I hope that’s all right with my Swedish audience too.)

The last few weeks I’ve been working with an updated version of my script waxon, used for giving my students volume training on math exercises. Today I ported a very important question type: creating algebraic expressions and equations. It presents students with a situation described in a short text, and asks them to write down equations or expressions describing the situation. Students may be asked to select variables themselves, or the variables may be chosen for them.

For example (sorry about the mix of English/Swedish):

”Goliath weighs twice as much as David. Write this relation as an equation.” (You can try out 2 example questions in English here, and 19 live questions in Swedish here.)

The student chooses variables and writes down an equation. It can be in any sane form – the equation is evaluated mathematically, not against a list of allowed equations. (It could be ”2D = G”, but also something like ”D+D+10G=11G” or ”G/D=2”.)

This is a type of exercise that students don’t get much volume training in, and it is also a threshold concept – meaning that:

1. Once you understand how to do it – you’ve broken the code – a whole new world becomes accessible.
2. Before you understand how to do it, it seems like magic.
3. After you understood how to do it, you can’t really understand how it was before you got it. (This aspect makes threshold concepts kind of tricky to teach.)

Though the questions are presented and evaluated through a computer, each situation is created manually and described in a short piece of code. I hope to create a lot of such questions, to complement the calculate-the-right-answer questions I also use in waxon.

If you by any chance are interested in writing such questions too, I’m giving a short description on how to do it.

## Example 1: Create an expression

waxon is written in JavaScript (actually Google Apps Script), and the question items are declared as an object with a few required properties. The items are collected in an array, containing all the available questions:

```var questionList = [];
questionList.push({

description : 'There is already 7 cm of snow on the ground when it starts snowing in the middle of the night. 3 cm of snow falls each hour. Write a function f(t) describing the thickness of the snow after t hours.',
variables : {
t : 'hidden',
},
questionLabel : 'f(t)=',
correctExpression : '7+3t',

});```

The interesting parts are these:

• description: This is the text that will be displayed to the user, describing a situation.
• variables: This is an object containing one property for each variable intended to be used in the question item. In this case the variable is set to ‘hidden’, which means that the user won’t have any chance to set it to anything else but ‘t’.
• questionLabel: This is the prompt to show before the box for the expression.
• correctExpression: This is an expression to compare the user input against.

## Example 2: Create an equation

Creating equation questions requires a bit more work, at least if you want the equation to contain more than one variable. Here’s an example.

```questionList.push({

description : 'Goliath weighs twice as much as David. Write this relation as an equation.',
variables : {
D : 'Variable for David\'s weight:',
G : 'Variable for Goliaths\'s weight:',
},
questionLabel : 'Equation:',
correctExpression : 'G=2D',
isEquation : true,
freeVar : 'D',
substitutions : {
G : '2*D',
}

});```

The interesting parts are these:

• description: Again, this is the situation that will be displayed to the student.
• variables: Here two variables are provided, each with a label. This label will be used before a text box where the student can make her own choice of variables – which may be a really good thing to practice on. (Variables are not case sensitive in waxon.)
• questionLabel: Again, this is a prompt before the box where the student enters an equation.
• correctExpression: This is an equation (yes, not actually an expression) to compare the student’s equation against.
• isEquation: The true value tells waxon that it should expect an equation, not an expression.
• freeVar: The actual comparison between correct equation and the student’s equation is done by varying the value of one of the variables. The name of that variable should be set here.
• substitutions: To allow evaluations of equations that have more than one variable, the equations are first reduced to one equation. Substitution formulas for this should be listed here.

If you would like some more examples, you can check out the first question list containing 19 expressions/equations with linear, quadratic and exponential expressions (on GitHub). If you find this interesting, feel free to contact me by commenting here or reaching out to me on the GitHub project page.

Annonser

## 5 thoughts on “Computer based training on creating algebraic expressions”

1. Det här verkar intressant. En liten korrigering: I en av dina uppgifter blandar du mellan sidor och blad. Du ber om variabel för sidantal men den godkända formeln beaktar inte att du har två sidor per blad.

2. Gillade upplägget! Testade några av uppgifter. Snyggt att den klarar av uttrycken skrivna på olika form. Har du byggt en egen parser (eller vad man kan kalla det) för uttryck?