# Basics

Explains

- the windows Euler uses,
- the notebooks,
- the command line,
- how to save commands and functions on files,
- how to deal with errors.

## Using the EULER windows

EULER uses two windows. The text window and the graphics window. In the Unix version, you have to switch between them by pressing the TAB key, in GUI versions you can alternatively use the mouse, of course.

The text window contains the menu and is for user input and output of EULER. The graphics window is displayed, whenever EULER draws output. The graphics screen is visible as long as there is no text output. In this case, EULER pops the text screen to the forground.

## Notebooks

This applies only to the notebook versions of EULER. Notebooks contain the commands, comments and EULER output. Old commands can be edited and changed. Text may be added to commands to explain it. Notebook files can be given to other people or can be kept as documented computations. However, collections of functions should still be kept in program files, which could be loaded as first command of a notebook. A notebook could accompany the definitions, which explains the use of the functions with examples. Another idea is to use notbooks for teaching mathematics.

The most important fact about notebooks is that EULER still uses the sequence of commands as they are executed. So if you change the value of a variable and go to previous command, the changed value is used.

You may not only change previous commands, but also delete them or insert new commands. Use the notebook menu to do this, or the keyboard shortcuts. If you change a command and execute it, its output is removed and EULER proceeds to the next command, unless you choose to insert all new commands. In this case, a new command is inserted after the one, you just executed.

You can delete the output of commands. To do this, select a text area and use the command in the notebook menu. All output of the selected commands will be deleted.

## Notebooks in old versions of EULER

Notebooks can be loaded from all versions of EULER. However, you cannot edit them. Use

        >notebook filename

for that purpose. It will prompt you after each command. If you press the Escape key, the file will be closed immediately. Otherwise, the command is executed. You can turn the prompt off with

        >prompt off

## The Command Line

Text can be entered after the prompt (>) using the keyboard. If a letter is wrong, it can be cancelled with the Backspace key. The cursor keys position the cursor back and forth in the line. The line editor is always in insert mode, so any character is inserted at the cursor position. The Home and End keys work as usual. Escape clears all input. Shift plus -> or< - position the cursor one word to the right or left. Finally, the input is entered by pressing Return. Then EULER will start to interpret the command. The cursor can be at any position of the input line, when Return is pressed.

Previous input can be re-called with the Cursor-Up and Cursor-Down keys. (On the notebook version use these keys with Shift). If a command is recalled this way and entered with Return, cursor-down recalls the next command; i.e., cursor-up and cursor-down are always based on the last recalled command. Clearing the input line also makes the last command the base for recalling (use Escape or Control-Cursor-Up). Thus Escape plus cursor-up recalls the previous command.

Pressing the Insert key extends incomplete commands. Pressing this key again gives another extension, if there is one. The search goes through the command history, the implemented functions, the user defined functions and the built-in commands in that order.

The End key will insert the text "endfunction", but only on empty lines in porgramming mode (see below). Otherwise, it works as usual.

There are some other special keys. The Tabulator key switches to the Graphics screen and from there any key switches back. The Escape key stops any running EULER program and some internal functions, like the 3-dimensional plots, the linear equation solver and the polynomial root finder.

The Page-Up and Page-Down keys provide a means to look at previous output from EULER. EULER keeps a record of the last output. When the command line becomes invisible, pressing any key will make it reappear.

Input can spread over several lines by the use of "..". The two dots are allowed at any place, where a space is acceptable. E.g.

        >3+ .. some comment
        >4

is equivalent to

        >3+4

Comments can follow the ".." and are skipped.

### Function Keys

The function keys may be programmed by the command

        >setkey(number,"text");

The number must be between 1 and 10 and the "text" may be any EULER string. Then the corresponding function key will produce the text, when it is pressed together with the ALT key . If the function key text is to contain the " character, one can use double quotes as string delimiters as in

        >setkey(1,''load "test";'');

which puts

        >load "test";

on the function key Shift-F1.

## Loading files

To abbreviate tedious input one may generate a file containing EULER input. This file can be generated with any editor. To load that file enter

        >load filename

All lines of that file are interpreted just as any other input from the keyboard. Also a loaded file may itself contain a load command. If an error occurs, the loading is stopped and an error message is displayed. There is a default extension ".e", which you should use for these files. You need not specify this extension in the load command. The filename may be included in double quotes. If you are using a string expression, include it in round brackets.

The best use of an Euler program file is to define functions in that file. Many predefined functions are loaded at each start of EULER. This works in the following way: EULER will load the file euler.cfg everytime the program starts. This file does again contain load commands, which load the necessary utility files.

EULER looks for the specified file in the active directory by default. You may specify a path with the path statement

        >path "..."

where the string should contain a path like ".;myspecial". This would put the active directory into the path and a subdirectory named myspecial. The path command is handy for network setups.

A file may contain a comments. Comments look like this

    comment
    This is a comment.
    Comments can spread several lines.

    Also empty lines are allowed.
    endcomment

endcomment must be the first string of a line.

You can turn comment printing off with

    comment off

Otherwise all comments in a file are displayed, when the file is loaded.

    comment on

turns this feature on.

## Euler Errors

If a computation error occurs, Euler will issue an error message and try to print the offending input. This may either be a place in your input from the command line, a command line in a loaded file, or a line in an EULER function. In the latter case, Euler will print a stack dump of function calls.

You can generate an error yourself and print an error message with

    error("An error occured");

If this line is in an Euler function, execution will be stopped, and the normal error routine is called, generating a stack dump.

It is also possible to test an expression for errors. This will not generate error messages (indeed it will surpress all output), and return an error code and, if available, a result. An example is

    {n,B}=errorlevel("inv(A)");

The matrix A will be inverted to B, if possible, and n will contain 0. If the inversion fails, n will contain an error number different from 0. The variable B may not be used in this case. Use

    if n<>0; error("Inversion failed"); endif;

to test for an error.