[GAP Forum] line by line input for classroom use

Stefan Kohl kohl at univlora.edu.al
Wed Jan 13 20:48:30 GMT 2010


Dear Forum,

Barry Monson asked:

          I am using Gap in a course on computer algebra. Naturally I want
> to prepare
> typical commands or more involved examples to discuss in class. But I don't
> want to type
> each
> line in when in class, if only to keep chalk dust away from my laptop.
>           So suppose I have several examples already entered into a file
> called stuff,
> which looks like this, say:
>                             # here is a list:
>                              a:=[4,3,3,4,2];
>                             # Make it into a set:
>                              se:=Set(a);
>                             # Now for a group
>                              G:=Group((1,2,3),(3,4,5));
>                              Size(G);
> Here the file "stuff" ends.
>           Is there some command from the Gap session which would let me
> read in (but
> not execute)
> such lines one by one, say when prompted by some function key; then I'd
> execute the
> current line,
> discuss the result, then request the next line in the pre-prepared file
> "stuff", etc.
>           So of course I don't want a simple Read("stuff") command.
>           Sure I can have "stuff" open and copy/paste into the Gap window.
> But
> I'm wondering if there is a slicker solution.
>

Such a function already exists in GAP, but is presently not documented.
You should prepare a file exactly in the format you suggested, and run the
demonstation by issueing at the GAP prompt:

ReadLib( "demo.g" );
Demonstration( "yourfilename" );

Then each keypress runs the next line of your input; the key "q"
interrupts the demo.

You can find the source code of the function "Demonstration" in lib/demo.g
in your GAP home directory; you may enjoy modifying it for your purposes.

A variation of that code is provided as a small utility function by the
RCWA package, see ?RunDemonstration.

You also might be interested in an installer and a shell that have been
built
specifically for teaching purposes:

http://www.math.colostate.edu/~hulpke/CGT/education.html<http://www.math.colostate.edu/%7Ehulpke/CGT/education.html>

The shell provides a worksheet interface similar to Maple.
After reading in a worksheet, one can execute the commands one by one
by hand.

Hope this helps,

    Stefan Kohl

---------------------------------------------------------------------------
http://univlora.edu.al/personel/kohl/
---------------------------------------------------------------------------


More information about the Forum mailing list