Pari-tty

Userinterface for Pari-GP
(Windows XP/ Win98)

Comments to
Gottfried Helms,
Uni Kassel
mailto:helms@uni-kassel.de

Software-Index


Screenshot     Introduction        Download        


Introduction:

Version 2.03.2.56 (Beta)  (2011-01-10)

Pari-TTY is a notepad-orientated user-interface, intended as easy-to-use entrypoint to Pari/GP.

 

Pari/GP itself provides only a line-oriented interface to the user: type one formula - press [return] - and see the result. Just like in older terminal programs. Its line-editing mode is not bad, but for me as occasional user who has his line-editing phase 20 and more years behind him this makes no more sense.

 

Thus I provide a interface, where you can use the conventional windows-notepad-functions to interact with Pari/GP. however, still you can type one formula, – press [F2] (instead of [return]) – and see the result in the output window.

 

But the new comfort is, that you can easily edit and correct your input, copy&paste per clipboard, use multiple notepads, include syntaxfiles while editing and so on.

 

The name PariTTY was chosen because in the background the interface does its conversation with Pari/GP in the single channel/single-line mode: one question – one answer – one question – one answer… and does also not intend to be a giant, multi-featured textprocessor or the like.

 

 

 

The notepad interface PariTTY provides this features:

·    multiple notepads for your Pari/GP-commands, all sending to the same Pari/GP-instance

·                           Notepads can be read & saved by conventional windows file-dialogs

·    multiple notepads for the outputs.
So you can open a new output window, if you need intermediate help or
just want to try another formula without destroying your current protocol.

·    (V 2.2.1) multiple named output-"sand-"boxes (%box-command); each for a single matrix (non-appending!)

·    (V 2.2.1) clipboard-support, formatted as CSV or (mime-) Tex from each sandbox (Version 2.2.1)

·     (V 2.3.2)              sandboxes can be closed by %close-command

·     (V 2.3.2) sorted list of user-functions in extra sandbox by %function – command

·    A refined printing command (%print) as well as a bitmap-creation for matrix – output (%bmp) is provided

·    The outfit can be customized interactively or by editing the paritty.ini-file
(size of output-font, screen-colors, path to user-program-files).

·    The Pari/GP-instance can be shut up and be restarted without quitting PariTTY (for instance in case of severe errors).

·     (V 2.3.2) automatic logfile. Guaranteed, that last line has been written to logfile, even if windows shuts down.

 


Short, incomplete history:

New 2.03.01 : the problems concerning Win98 still not resolved
seem to be resolved(corrected for timing problems due to the exorbitant loading time on small computers: ~ 1 min with 250 Mhz CPU / 128 Mb Ram). Recommendation: disable autostart of Pari/GP with Pari-TTY

New 2.02.02 : vertical orientation of main-window, some small corrections.

New 2.02.01 : Outfit of Boxes improved, Menubars can be hidden; see there.

New 2.01 : Parameters for %box, clipboard, see there.

The Pari/GP-{}-bracket behaviour is now implemented
New 1.02 : Parameters for %pri , %bmp , see there.

Extensions are planned, suggestions welcome.


 

How it works

The starting screen

Bild1

You see the right (white) and left(blue) window. The right window is for your programming, the left is for Pari-output.
Pari/GP is not started until you press the ON-Button. Since version 1.3 Pari/Gp will be autostarted, if set in options-file (default)
The view changes to

start


where the Pari/GP-version and some start-information occur. Note, that he interface was developed using Pari/GP v 2.11. Changes to later versions, which may affect the dialog-behaviour of Pari/GP may provoke problems in the communication of Pari-tty and Pari/GP.



Now you can compute a formula. You use the right window, write down a formula and press [F2] or click the [CAL]- button
intro 3
Your line, where the cursor sits, is simply sent to Pari/GP which works invisible in the background, and Paritty waits for an answer. If an answer arrives, that output will be put into the protocol window at the left side of screen.

The main philosophy is:

·     one line: 200+400                                                     ----> one output

·     one line: 200+400 ;                                                   ----> no output (indicated by the semicolon)

 

·     one line, multiple statements : a=12 ; b= 3^a - 1       -> output only of the last statement

·     one line, multiple statements : a=12 ; b= 3^a - 1 ;     -> no output


Continuing a line, if a formula does not fit in one row:

bild4


you use the same line-continuator as in Pari/GP, mark both lines and send them together to Pari/GP.

Note, that Paritty and Pari/GP work asynchronously together, that means, that Paritty sends a command, and principally immedeately returns to user-action. To get things synchronous, I had to implement a waiting loop, which looks- for a reasonable time- whether some output occurs from the Pari/GP-line ... or what...

If no response comes - for what reason ever - there is no consistent way to know Pari/GP's reason for that. If you are waiting for an unreasonable time, you may press the [brk] button, which will become visible, whenever you've sent a command before Pari/GP answers (Pari-tty is waiting). If a response arrives, the break button will be invisible and you may proceed.
However, if a long calculation is running, you can already continue typing the next formula, but you should not try to send the next command, before there is the output from Pari/GP: it simply will not be sent to (or at least not be accepted by) Pari/GP.


 

Caution: asynchronuous conversation Paritty <--> Pari/Gp

 So some trouble can occur, if Pari/GP does not respond because of an error or because it expects more input... there is no internal message, that Pari/GP would tell the user-interface:.. ok, I'm just computing, please wait ... or : ... well, I'm expecting more input... : the situation is not recognizable for Paritty.
The following "hang"s have occured:

·      sending (sets of) lines with opening bracket {, but no line with closing bracket }

·      sending lines with unbalanced quotes "

·      sending lines with  \  at end but no following line

·      sending lines with  =  at end but no following line

·      sending line with "...text...", where text contained a character with high ascii-code; I'd liked to printout my complex numbers with î - but that made the Paritty/ Pari/GP-dialog hang.

You may cure such a "hang" by pressing the [brk] button and send a line with the assumed medicine: a single quote, a following line or what you suspect to be the thing, Pari/Gp may wait for..
If nothing helps, you may quit Pari/GP by clicking the [off] - button and restart Pari/GP after that again:

bild5


Differently to the Pari/GP rule you may send even multiple lines wihout ending ';' - each line is send to Pari/GP individually as a single conversation, but only the last result will be shown:

bild6

You may comment your lines like in Pari/GP and even you may use commenting behind a line-continuator (the comment-symbol and the following text are removed by PariTTY before commands are sent to Pari/Gp:

bild 7

Paritty proceeds this way working with your input:

·     read marked block of data or the line, where the cursor resides (full lines will be read anyway)

·     cut line-comments

·     join lines as required by line-continuators to single "command-lines"

·     send each command-line to Pari/GP as one conversation

·     print result of last Pari/GP-output (from which the Pari-prompt is extracted)

So -hopefully- the Pari/GP-readln-buffer is big enough to chew your input, if many lines are concatenated by line-continuator..


 

Using multiple protocolwindows

For instance: when invoking Pari/GP-Help

If you call for Pari/GP-syntax-help, you use your help-command ?. and you possibly do not want to litter your previous output.
You may just open another protocol-window, and Pari/GP's output is directed to this protocol:

bild 8

and ask for this or that...

bild 9

without littering your previous protocol. Moreover - because there are many such protocol-windows possible, you need not repeat a previous request, and/or you may open one output for experimenting with a function, and one protocol for the final output.


The same is valid for the programming-window ("syntax-window"): you may use multiple instances for different tasks:
one for developing and debugging a function - and one where you collect the final working versions to save them later as function-library.
Here I have my "matrixdefinitions": a collection of some matrix-functions, which I load in a second window, if I want to add or correct a function:

bild 10

One may text-mark the whole text and send it as commands to Pari/GP or use one new feature of Paritty.

Additional features of Paritty

Inserting the name of a default-directory in the Pari/Gp  \r-command

As you may have observed, in the status-line the full filename, containing the pathname is shown. Since in each window I can load Pari/GP-Syntax-files for different locations, Paritty  provides the "syntax-file-path" with the meta-tag %, which is evaluated with the read -\r  filename command, and a filename without path but preceded by % will be completed by the path of the syntaxfile, from which it is called:

bild 11

The last command line in Matrixdefinitions.gp is to print the value of the used "n", so I know, what size my matrices have (and that the file was read successfully).


 

Pari-TTY-meta-commands (%print ..., %bmp..., %box ..., %project ...%functions … %close   %wordwrap)

A "beautified printing" device: %print matrix-expression

To enhance the "beautified"-print in Pari/GP I implemented the %print matrix-expression for even more beautified matrices:
the matrix entries in columns are adjusted to arbitrary many columns and rows (depending on your computer memory)
Paritty detects triangular and diagonal matrices (real-matrices containing 0) and in that case systematic zeroes are replaced by full stop:

bild 12

The syntax and options are the same as in the following %bmp-command.


 

Creation of Matrix-bitmaps: %bmp matrix-expression


Paritty can produce bitmaps of matrices in this adjusted format. This bitmaps can then be inserted into your documentation:

·     %bmp matrix-expression            \\as title the matrix expression will be used

·     %bmp matrix-expression : title    \\you may provide an explicite title

·     %bmp  % options %  matrix-expression : title    \\you may provide some printing options


bild 13

The bitmap can then be used by copy&paste via clipboard or it will be saved in the protocol-file.

To adjust the columns for multiple matrixes simultaneously, they all must be called by a single %bmp-command.
Multiple statements are separated by comma; each matrix can have a title, this is separated by a colon. If the text for the title contains non-alphanumeric characters it must be enclosed in the usual quotes for Pari/GP-strings:

%bmp dJ : J, Pj , Gp, Gp^-1 : "G^"

bild14

and the bitmaps fit into a matrix-multiplication scheme with simultanely adjusted column-widths:

Gp * J = tmp  
tmp * Gp^-1 = Pj

meaning

Gp * J * Gp^-1 = Pj

thus Gp is an eigenmatrix of Pj with diag(J) as eigenvalues, using the above bitmaps:

 

j

gpinv

gp

=Gp*J

pj

 



New: 02-11-2006: You may provide some printing options

%bmp %options%   dJ : J, Pj , Gp, Gp^-1 : "G^"

for options you may provide:

%bmp      % r=6 c=6 %           \\ submatrix rows, columns; -1: no limit

%bmp     % d=4  %                 \\  decimal-point, rounding; -2: nothing -1:align, auto,
                                                   \\      0..inf :number of  digits after dec-point

%bmp     % f=";"  %              \\  a character as field-separator

%bmp     % f=T  %                 \\  a tabulator as field-separator

The options are then defaults for all subsequent %print, %box, %bmp-commands until they are again changed.




New: 22-09-2007: You may open named "sandboxes" for individual matrix-outputs. These sandboxes do not append a second output but overwrite the previous. I needed that for checking of the quality of approximations in matrix-multiplication, where I did not want to save all my trials as full output in the listing-file. 

%box >mybox %options%   pari-matrix-expression

This creates a new sandbox for output with name "mybox". If ">mybox" is omitted the output is directed into the current sandbox.
For convenience the %print and %bmp-commands may take this redirection, too. (The %bmp command produces then a bitmap in that box)
One can position a sequence of such expressions in one command; but the last expression should *not* be delimited by a colon (you don't see output then)

%box >mybox %options%   pari-matrix-expression;  pari-matrix-expression

Support for the clipboard

%box >clip %options%   pari-matrix-expression

sends the output of the Pari/GP-result directly to the clipboard. This is also possible with %bmp and %print-command

There are also 3 buttons for formatted clipboard-output at each sandbox:
clipboard




Window-Arrangement: Option to modify working-window: vertical or horizontal ordering of syntax and protocol.
main-window

Minimize menus and bars: Option for collapsing the menu/toolbar

bars hide

Collapsed :
collapsed

For Boxes:
bars

Collapsed:
Hidden


A desktop can look then as such:

desktop

Project-naming

A project can get a name; this name occurs then in the title of the application (referenced in the windows task-bar) and is also a default filename-prefix.
No other options are availbale so far, but I think, I'll implement a complete project-management with function libraries next version.

%project myname

"myname" occurs in the title of all windows, and as well in the task-bar for this pari-instance.
projectname



Wordwrap in the protocol window

On request I enabled switchable wordwrapping for the protocol-window.

%wordwrap   1             \\ sets wordwrapping on
%wordwrap   0             \\ sets wordwrapping off
%wordwrap     \\ toggles between states of wordwrapping

 


Older versions


 

Plots

The ploth-function can be used; a single external window will open for each plot

Plotfenster


The Pari/GP-Plot (GNU-Plot) occurs in a separate window

ploth

Ploth: Caution:

For a reason, which is not known to me, Pari/GP will not close that plot-windows when /q-uitted.
You
*must* close all ploth-windows before

·     stopping Pari/GP

·     terminating Pari-tty

Otherwise: Paritty will hang and its process must be cancelled by the windows-taskmanager.

(new 22.09.2007)  I seem to have successfully solved this problem, but it is not much tested yet.


 

Configuration of the program

There is not much to configure; you may use an editor for the ini-file or the integrated configuration-utility.
Since Pari/GP comes with the old DOS-Terminal-outfit, and even another GUI-creator made his program looking like a console, Paritty has now also an outfit-option

You open the configuration window :

opt1

This opens the dialog for options.

The dialog for "options"

Optionen

Here you may

·     set paths (page "Basis"),

·     adjust the GUI-outfit with back- and foreground colors for the protocol-window (the "Pari/GP-terminal")

·     or open the debug-window (this can now be done simply by right-click in a protocol-window).

A more common coloring scheme would be:

Konsolefarben


 

The Debug-window

If frequent "hangs" occur, and you may try to find a reason by inspecting the raw, unfiltered output of Pari/GP, you may open the debug window, which does nothing else, as to add the buffer-packets, sent by Pari/GP to the lines of the edit-field.
You open/close the debug-window using the contextmenu when the protocol-window is active: mouseclick or cursor (right-click mouse)

debug

A sample output is then

debug2


and, for instance, one can see the two prompts gp> gp> which Paritty expects as answers from Pari/GP, that it has finished its work and is ready for new input. If  there is a problem with these prompts or some other effect, which I didn't yet reflect in the program, then one may see the last Pari/GP output and have an idea, what's going wrong.


Additional Installation-remarks:

The installation is simple and follows common uses.
Note, that you need to apply a path to the Pari/GP-Program, before you can work with Paritty.
There are three pathes of importance:

·     - the application path, usually placed in c:\programfiles\paritty

·     - the windows-system-path for the runtime-modules and font

·     - the user path, where the user prefers to place his variable data: programs and protocols, where the

·               user programs are stored under userpath\syntax  and the
user protocols  are stored under userpath\listing


About:

 

About

 


Ende


Gottfried Helms, Uni Kassel

Email:  helms (at) uni-kassel.de
Software:  http://go.helms-net.de/sw