HomeTI-Nspire Authoring Support ← Creating Interactive Documents using Notes and Programs


Creating Interactive Documents using TI-Nspire 2
Interactive Notes and Programming

Stephen Arnold
Compass Learning Technologies, Australia

Download an Interactive Sampler.

The release of version 2.0 of TI-Nspire™ brought with it some significant enhancements. In particular, we now have two additional environments within which it is possible to create interactive learning environments. The hunble Notes application is now fully interactive, and programs run from the Calculator now support dialog boxes for display of text and for input. Together, these additions make an already powerful tool even more appropriate for teaching and learning at all levels.

Prior to early 2010, the main vehicles for developing and delivering dynamic TI-Nspire documents were the Graphs & Geometry application (G&G) and the Lists & Spreadsheet application (L&S). Although powerful, both had quite significant limitations. For G&G, it was a very limited ability to handle text in any sort of dynamic way. Text could be displayed, but strings could not be acted upon, as they could in the spreadsheet. When wanting to display mathematics (especially numeric and symbolic mathematics) the spreadsheet was a far more flexible environment. But L&S was constrained by the display baggage which it brought along - fully half the screen was occupied by the headers, and the contents of cells were very limited by the maximum width of these.

Interactive documents developed in both these environments also suffered from limited control over what the end user could readily break: while some limited "locking" was available, it was generally very easy to "break" the applets that were developed.

These constraints have been dealt with in the changes made under 2.0 to the Notes and programming environments. Notes is now fully interactive - similar in many ways to the previous interactivity of the spreadsheet environment, but without those annoying display limitations! And the addition of input and display dialogs in programs means that information can be presented to students, questions asked and answered, and feedback provided - all in a completely safe and secure environment. The only option the user has is to answer the prompt, or exit the program. Unlike the exposed cells of a complex spreadsheet, or the text boxes and linked objects on a G&G page, all the workings of such a program are safely hidden from prying eyes and inquisitive fingers!

Welcome to Interactive Notes

Top of Page

Notes has always been capable of evaluating mathematical expressions and commands. Entered into what is now called a MathBox (or MBox), the option existed to "Evaluate" or to "Evaluate Selection". This resulted in the expression being replaced by the result.

The new MBox is now evaluated simply by pressing enter when within the box, and the input and output are displayed (alhtough this may be easily customized, allowing for either to be hidden). Variables may be defined and called anywhere within a document.

This new Notes environment can effectively replace the Calculator if desired: the only Calculator functionality not supported here is the programming environment, and this is reflect in a new "Calculations" menu.

Within a MathBox, enter a command, define a variable or type a calculation; press enter and the result is displayed (in Normal view, input is blue and the output is red). The difference can be seen in grayscale when in HandHeld view, as shown.

The true value of this working environment, however, is more likely to lie in its nature as a natural workplace for text. It is just that we can now mix mathematics with that text - and even make the text itself dynamic. Much of the powerful functionality previously associated with the wonderful TI-Interactive™ software has now been realized within TI-Nspire Notes.

In the example shown, a questions is posed and two MBoxes are displayed. The first displays a random example of the type of question under consideration. Notice that the input is hidden and only the output is visible. The second MBox generates the next random question: change the value of the variable "next" and the text above will change.

This is a very simple example of the dynamic text capabilities that are possible in this environment, but offers a suitable place to start.

To understand what is happening here, it is helpful to expose the background workings of this page, beginning with what is hidden further down the page, where a variable called my_x is defined. You will see that this variable is defined using the randInt command, and lies between -10 and 10. You will also notice that the value of the variable next is added, and then subtracted to this random integer. In this way, the value of next does not change the output, but does make it dependent upon this variable, making it a "trigger". Change the value of next and the value of my_x will also change.

Now we are ready to display our example. this will be defined using the usual "when" statement that we have come to expect. When the value of my_x is less than zero, then "2-my_x" should become "2+my_x". When my_x is greater than or equal to zero, then it should display as simply "2-my_x". Study the long "when" statement shown and see if you can follow the steps.

The entire output is a string (and so lies between "quotes") - actually a "string of strings", glued together using the "&" operator. Since the variable my_x is a number, then in order to be part of this string of strings, it must be converted to a string using the "string" command. Note that it is still dynamic: change the value of next and the value of my_x AND the string version of it will all update.

When my_x>0 then display "2-my_x= the answer". But what about when my_x is less than or equal to 0? Then we display "2-my_x (eg 2--3) =2+ abs(my_x) = the answer (string(2-my_x)).

Can you see the essential limitation of Notes at this point? It is not well placed for students to enter and change the contents of MBoxes. As soon as one enters an MBox, the entire workings are exposed, which can be very distracting. And even to change a simple value like our next variable, students must click inside the box or move to the correct position.

A better option would be to use the Notes window purely for dynamic display, and to control changes from another window, such as a G&G window with sliders!

Sliders are a good vehicle for student entry of numeric values, since by TABbing, the user can easily highlight the value of the variable, then type and press enter to change that value. If the slider is minimized (as the New variable is in the example shown), then just by clicking up or down new values can be generated and the question refreshed.

By the way, did you notice that in this last example, there is a substantial improvement in the style of the interactive question? In the first example, the only engagement offered to the student was to change a number to produce a new question - cognitive challenge> Nil. Engagement: doubtful. Even the example question was fixed to the form "2 - ".

In this example, the student is challenged to actually commit a numerical answer using the answer slider, and is given feedback on that answer. The question, too, is randomly generated, so the engagement level is likely to be much higher.

This is achieved using two functions from the Polynomial Toolkit (http://www.compasstech.com.au/TNS_Authoring/poly.html): prand(num) which generates a random polynomial of degree "num", and xpress, which formats that polynomial correctly (taking something like "2x+-5" and expressing it as "2x-5". Once again, by adding and then subtracting a trigger variable (in this case, new) the random polynomial is updated each time the slider for new is clicked.

The final touch would be to allow students to enter their own questions and then to try different values for these. This is easily achieved, using two other simple Toolkit tools, pvar("x") (run once to define the variable x - it can then be removed) and pdisp, which takes a function entered and converts it to a string, which can then be acted upon and displayed.

Using such methods, the opportunities presented by this wonderful new interactive environment are great. We are presented with an ideal tool for displaying our text and computations in a dynamic way.

Introducing Interactive Programs

Top of Page

Three new programming commands were introduced in the 2010 update, all defining floating dialog boxes: "Text" (which displays strings in a floating window), "Request" (which allows a string as a question and accepts the numeric result as a variable, and "RequestStr" which accepts the response as a string. Both Request and RequestStr have their question string limited to 40 characters, while Text is limited only by the size of the viewable window.

The example shown uses the "Text" command to display a statement, the elements of which are randomly generated. Upon pressing enter, the text is dropped into the Calculator entry line as a display and serves as a record of the interaction.

These dialog boxes may be used only within programs (not functions). Now programs can be run within the Calculator and also within Notes; however, when running in Notes, there is no display of intermediate steps (including dialog boxes) so all that appears in the Notes page is the result "Done". To see displayed steps and dialog boxes, such programs need to be run within the Calculator.

It is worthwhile studying the program structure for this simple little example. The first line defines the program name ("quiz0") and in this case, it takes no argument (nothing in the parentheses). The next line begins the Prgm syntax and a comment line appearing before anything else will appear as help in the Catalog (up to 40 characters).

Next we define any variables that we are going to use as Local, so that they do not hang around after the program has run. If we want variables to remain afterwards (global) simply don't include them in the "Local" list.

For this program, we need a random variable for x (we will call is "xv") and we will need the final result ("answer") as well as the "question". Note the way that the question is defined using, not a "when" statement, but an "If...then...Else...EndIf" block. Again, as with previous examples, the various string components are glued together with "&". Finally, the "Text" command displays the dialog box.

To view a defined program (or to Import one from a Library file) use the "Insert" menu under "Program Editor".

For a slightly more interesting example, we could use the prand function from the Polynomial Toolkit to generate a random expression. This actually makes the program even simpler. Define a function "fn" as a random polynomial of degree 1, define "xv" as a random integer, and then define the answer as a string which uses the "expr" command to evaluate a string. Hence, if we have a string "2+3" then expr("2+3") will actually output the numeric result 5.

In this case, we glue together strings to form the statement, fn|x=xv using fn&"|x="&string(xv). Taking the expr of this will evaluate it, and we want the output as a string, hence we get the form string(expr(fn&"|x="&string(xv))).

Now for something a bit more interactive: a random polynomial is generated and students are asked to substitute the value of a random variable.

This involves a "Request" command and the program evaluates the answer that the student types and responds with either "Yes!" or "Sorry", followed by the correct statement.

Can you see how this might be set up?

Just as before, but this time we introduce a new Local variable called "input" (we can call these variables anything we like, of course). We define our random function using prand (Note that we have actually imported prand into this problem so we no longer need to point the path back to the poly.tns file which is its source). We also define our random variable xv and our answer.

Then the simple "Request" command: Request "Text",input.

The input is tested against our answer and the feedback is provided accordingly.

Finally, we add two finishing touches: the ability for students to enter their own question, and the feedback being a little more forgiving: if they get it wrong, they get another chance; if wrong again, it gives them the result.

Study the program shown and see how these effects are achieved.

Right at the start, we see the "RequestStr" command used, allowing students to enter their own function and have it received as a string. The xpress function from the Polynomial Toolkit ensures that it is presented correctly.

This brief introduction to programming on TI-Nspire hopefully provides a sufficient taster to get you started trying out your own programs - and these are limited only by your imagination!


APPENDIX: Some Useful Commands

ApproxRational(number) - converts (where possible) a decimal to an exact form as either integer or fraction. For example, ApproxRational(0.6) = 3/5. When evaluating the results of strings, even whole numbers may come out with a decimal point (such as "2."). Use this command to return to nice whole number form: ApproxRational(2.) = 2.

expr(string) - evaluates (where possible) a string and outputs a numeric result. For example, expr("2+3") = 5.

GetType(input) - a useful test for whether a function or program is defined: For example,

If gettype(xpress)≠"FUNC" then

The main types are "NUM", "STR", "FUNC", "PRGM", "MAT".

string(number) - returns the result as a string.

   Include your entire program here

This little block command is Gold! Cannot be used with functions, only programs.

What happens during a program if a student does the wrong thing? Types in a letter when the input is expecting a string? Hits ESC or types nothing and just presses enter instead? Normally, an error dialog will come up, inviting the user to go to the source of the problem and helpfully opening the program code!

This is not at all what we want our students to be doing when they use our programs. By wrapping a Try...Else...EndTry block around our program, if anything unexpected happens, the program simply quits - no error messages, no invitations to fiddle with our code! As well as the important ClrErr command, you can even include some other actions - like a message that warns them that they did something wrong!


Top of Page


©2009 Compass Learning Technologies Home TI-Nspire Authoring Support ← Creating Interactive Documents using Notes and Programs