# Basics

This file 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. You can switch between these windows with the TAB key. You can alternatively use the mouse to click into one of the windows, of course.

The text window contains the menu and is used for user input and output of EULER. The input and output is organized in "notebooks" (see below).

The graphics window is displayed, whenever EULER draws to it. It remains visible as long as there is no text output. EULER pops the text screen to the foreground as soon as some procedure prints text.

## Notebooks

Notebooks contain the commands, comments and EULER output. Old commands can be edited and changed. A comment may be added to each command using a built-in editor.

Notebook files are useful for communication of Euler computations to other people, or to archive documented computations. Collections of functions should still be kept in program files (see below), which, however, may be loaded in the first commands of a notebook. A notebook could accompany program files, and explain the use of the functions with examples. Another idea is to use notebooks 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 later and then 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 toggle a switch to insert 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.

## The Command Line

Text can be entered behind the prompt (>) using the keyboard. Letters 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 current 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 executed by pressing Return. EULER will then 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 Shift and the Cursor-Up and Cursor-Down keys. If a command is recalled this way and executed 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 programming 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 works as usual.

Input can spread over several lines using "..". 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

        >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.

## Euler Files

To abbreviate tedious input one may generate a file containing EULER input. Such files 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 those files. Many predefined functions are loaded at each program start. 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 contains a path like ".;myspecial". This would put the active directory into the path and a subdirectory named myspecial. The path command is useful for network setups.

A file may contain 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 suppress 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 pass an error to the user.