HomeTI-Nspire Authoring ← Advanced Techniques 1

## Creating Interactive Documents using TI-Nspire

Steve Arnold

In this series, we will work through three advanced techniques useful for authoring interactive TI-Nspire documents: generating random questions, building step-by-step instructions, and making calculated values appear and disappear, like text.

1. Generating Random Questions

Whether this method is intended for use with Graphs & Geometry, or within a Lists & Spreadsheet page, the method is essentially the same: use of the RandInt command along with a "trigger" which will serve to force new values on demand. For our first example, suppose we wish to generate a set of questions involving order of operations: 3 random numbers with a + and a x between them, as shown.

Top of Page
We begin with a G&G page where the trigger will be a slider called "question", set to run from, say 1 to 10 in steps of 1. I would normally Minimize the slider, but leave the value of the variable visible so that the user can tab into it and type a value if desired (much quicker and easier than trying to arrow up and click on up and down arrows).

Use the Text Tool to enter the formula shown: randInt(1,10)*question/question. Each time a Calculate is performed on this formula, it generates a new random number between 1 and 10. The value of the variable "question" has no effect except to trigger a change of value in the output. Simple. Place a "+" and a "x" between the values and you have your question - but what does the student do? Where does the student enter their answer?

We could simply have a text value on the screen somewhere that the user can double-click to edit and type in their result - a "when" statement can check whether this value agrees with val1 + val2 * val3, and a check mark or the word "Correct!" can appear and disappear. Alternatively, a slider, called, say, "my_answer" with the value visible can be used - students just tab into the slider value and type their response, which is checked as before. This is actually easier for less experienced users than trying to double-click and edit text values. When Calculating the "when" statement, too, the slider existing as a variable means that instead of having to mouse up and click on the value, it is enough to just press "L" to use the values for "question" and "my_answer".

L&S makes it easy to have several questions being generated at the same time (this is also possible within G&G by just generating multiple lines of random numbers. It also allows this to be done without having to create variables, which is great if you want to re-use the applet again within the same problem.

Top of Page
First, place a trigger value in cell B6 - any number, say 1. After entering answers in column B to the five questions and pressing enter after each, the user finished in cell B6. Pressing enter again will generate five new questions so that the student can just arrow up to B1 and try some more! NOTE: there is a simpler way to trigger new questions within Lists & Spreadsheet, and that is simply to instruct the user to press ctrl-R - no need for reference to trigger cells, or extra random integers!

I like to place my formulas out of the way of students, so I put them down around row 10, then just point to the cell, as in the example shown: the student is in cell B2, which simply shows the real result, which is in B11. If this is deleted, nothing is lost.

So next we go down to row 10 - we are using columns A, B and C for our workings, so I begin in cells D10, E10 and F10, where I enter the formula: randInt(1,10)+\$B\$6-\$B\$6. (Using plus and minus here means that if a zero value is entered in B6, there is still no problem - it still triggers the random generator as required.

In cell A10, I can now enter the formula: =string(D10)&" + "&string(E10)&" x "&string(F10)&" =". What is being seen for the question is a string, which we produce by joining a bunch of strings together (including those numerical values that we generated from out random generator). [By the way, if we left off the &" =" from the end so that what appeared was a valid mathematical expression, we could drop "=expr(a10)" into a cell and it would be evaluated (even though we are using the symbol "x" instead of the usual "*"!]

Cell B10 is just "?", and cell C10 is a 3-way piecewise function: an empty cell if B1 is "?", a tick if the value in B1 equals the calculated value, and empty otherwise.

Now just select from A10 to F10 and fill down to copy these into five consecutive rows. Into cell A1, type "=A10", B1 can be just "?" and C1 becomes "=C10" and all is done!

Notice that, although the spreadsheet layout is a but bulky, it is very easy for students to enter their answers, much more so than within G&G.

Top of Page