Extcalc is a scientific graphic calculator for Linux. Extcalc is able to process difficult
mathematical functions, to draw graph and to work with them. It includes a C-like script language.
This is the documentation for version 0.9.3 beta.

Due to the porting of Extcalc to the new version of Qt, some pars of the user inerface are not accessible in this version.
This concerns the graph analysis and matrix/vector functions.

This Tab is a normal calculator. You can input a calculation in this window

1. Using the keyboard

First click into the text window so that you can see a write cursor there.
Then input the calculation by your keyboard and press Enter to calculate.
You can not use all functions of the calculator with your keyboard.

2. Using the integrated buttons

You can see most operations on the buttons of the calculator.
Just click into the text window and push the buttons you need. The text
you type will be inserted at the cursor position. If don't edit the last line,
the content of this line will be copied into the last line.
Press the "="-Button to calculate.

3. Function catalog

If you press the catalog button in the menu bar, you will see
a list of all operations and commands that are supported by the calculator. The list is seperated
into groups of operations and commands. When you choose an operation from the menu, the text is
copied into the calculator window.

4. Constants and Conversation

This button shows you a menu with a list of mathematics and physics constants. You can choose a
constant and add it to your calculaton. You may also add your own user defined constants to the list.

Special keys:

DEL

This is the same as Backspace-key on the keyboard.

AC

This key removes the complete history.

Shift

Press this button to use additional operations

Alpha

Press this button to use variables

hyp

Use this button for hyperbolic functions.

ANS

This is the answer-memory. Use this key to recall the last result.

Calculation Priority:

Highest is first

Brackets

Special operations: integration, differentiation

Binary operators 1: root, power, ...

Unary operators: sin, cos, log, ...

Bit operations: &, |, ...

Binary operators 2: *, /

Binary operators 3: +, -

Compare operations: ==, !=, ...

Set operations: ->, =

Logic operations: &&, ||, ...

Syntax - How to input calculation formulas

Operation

Key

Usage

Example

Square Root

expression

Use brackets for calculations under a root
To use the square root operation first press the square root button and then insert the argument

Cubic root

+

+expression

Other Roots

expressionexpression

To use this operation, first type the degree of the root and then type the argument.

Random Number Generator

random number key

(Number between 0 and 10)
The number after the "rnd" is the maximum value of the random number.

Differentiation

(function,x-value)

The function parameter must be X. Example: 2X^3-3X+3
The result is the is the gradient of the function at the given x-value.
The program can only calculate an approximated value of the differentiation.
The precision is about +/-1e-8

Integration:

(function, start value, end value)

The function parameter must be X. Example: sin(X)*3
The area below the graph of "function" between "start value" and "end value" is calculated.
An integral calculation will fail if there is a vertical asymptote between start and end point.
The precision is about +/-1e-9.

Usage of Variables

+ any letter.

You can use 26 variables to store values. To use the variables by the integrated buttons, press

Store/Recall Values

&nbsp

&nbsp

store a value use stored value
A stored value can be used like any other number. Unused variables are set to 0.

This is the mode for normal scientific calculations. All input and output numbers are decimal floating point numbers.
All scientific functions can be used here. In the quick preferences box, you can choose the angle type for trigonometric
calculations.
The variables from A to Z can be used to store results.
It is not possible to use non-decimal numbers in this mode and some of the logic functions are disabled.
If you want to use logic functions, choose the base mode and not the normal mode.

Complex Numbers

By default, Extcalc uses real numbers for calculation. You can switch complex numbers on by enabling them in the
cacluator preferences dialog or by choosing it at the calculator menu. Complex numbers can be written by using the i.
The following operations can use complex numbers:
+ - * / ^
root sqrt curt
sin cos tan
sinh cosh tanh
lg ln
abs arg conj real imag

When you press the "Mode" button in the calculator window, the calculator switches into base mode.
In this mode, you can't use scientific functions like sine and cosine, because the calculator uses 64 bit integer values for calculation.
The base of the input and output numbers can be changed into hexadecimal, decimal, octal and binary mode.

In base mode, the letters A - F are reserved for hexadecimal numbers, so they can't be used as variables.
But you can use the variables from G to Z to store results in base mode.
This mode is mainly used for logic functions and transformations between the different numeral systems.
If you want to input a number of a numeral system different to the default one, which you can choose with the
quick preferences box, you have to write a special prefix before the number:
Examples:

Hexadecimal

hex0FA46B
The letters in hexadecimal numbers must be uppercase.

Decimal

dec4575

Octal

oct01243

Binary

bin1000101111010

You can see all logic functions, which you can use in base mode, on the calculator keys. You can press shift key
to use additional logic functions.
The following functions can be used:

Logic functions

These functions return only true or false as a result.
0 is false and everything different from 0 is true.
&amp&amp (and), || (or), ! (not)

In this window of Extcalc, you can draw and analyze different function graphs.
You can choose different types of graphs and different types of coordinate systems.
This is a short list of the available types of graphs with a short description:

Graph Types

Standard Graphs y(x)=X

This is the standard for drawing function graphs. This type draws a normal 2D-Graph. The function variable
is X (a lowercase x can also be used).

Polar Graphs r(x)=X

this is also a 2D graphic mode, but it uses a polar coordinate system. X represents the angle and r is the
radius of the angle X. For this type of function, a polar coordinate system should be used.

Parameter Graphs x(T)=T; y(T)=T

This is a special type of 2D function. The function variable T doesn't exist at the coordinate system.
A parameter function contains two functions; one for the X-coordinate and one for the Y-coordinate.
Both functions have the same variable T. You can set the range of the variable T in the graphics preferences dialog.

Inequality Graphs y(X) &gt X, y(X) &lt X, y(X) &gt=X, y(X) &lt=X

When you use this type of graph, the area in which the function is true will be colored.

3D Graphs y(x,z)=XZ

This is the graph type for standard 3D-graphs. You need a 3D-coordinate system to show this type of graph.
The 3D-function contains the two variable X and Z. The Y-coordinate is calculated by this function containing X and Z.

Nyquist plots and 3D-Nyquist plots Y=Zi+Z

Both graph types can be used to show complex function graphs. The X-Axis represents the Real part of Y and the Y-Axis shows
the Imaginary part of Y. The function parameter is always Z. But at the normal Nyquist plot, the range of Z must be set by the
graph preferences dialog. At the 3D-Nyquist plot, the Z range is equal to the Z range of the coordinate system. This type of
Nyquist plot shows the Z-Value as a third Axis.

Dynamic graphs

All above described types of graphs can be used in a dynamic mode. For this dynamic graphs, an extra parameter A must
exist in your function. This parameter depends on the time. So you can show moving graphs.
This type of graphs needs much graphics performance, so you may need a 3D-Card for using this type of graphs.

Logic expressions

If this is enabled for a function, logic expressions like X>0 and script commands like if else can be used.
It should only be enabled when logic expressions or scripte commands are needed.

Coordinate Systems

It is possible to draw every type of graph in every coordinate system, but some combinations don't make sense.

Standard Coordinate System

This is normally used for standard graphs and also for parameter graphs. It is a Cartesian 2D coordinate system
with x-axis and y-axis. Both can be negative and positive. You can set a standard size and a trigonometric size for
the coordinate system. This coordinate system can be moved by holding the right mouse button and moving the mouse,
and it can be zoomed with the mouse wheel.

Polar Coordinate System

This coordinate system is mainly used for polar graphs. It has a maximum angle and a maximum radius, which can be
set at the graph preferences dialog. Both, maximum angle and maximum radius can only be positive and start at 0.
The coordinate system can be zoomed with the mouse wheel.

3D Coordinate System

This is the coordinate system for 3D-graphs, but it can also be used for all other types of graphs. It is a
Cartesian 3D coordinate system, which has x-axes, y-axes and z-axes. They all can be positive and negative.
The x-coordinate is horizontal, the y-coordinate is vertical and the z-coordinate is the deep. The 3D-coordinate
system can be zoomed by the mouse wheel and it can be rotated by pressing the right mouse button and moving the
cursor.

The graphics window of Extcalc consists of three parts: function table, output window and keyboard.

Function Table

In the first column of the table, you can insert all functions you need to draw.
You can insert up to 20 functions here.
If you want to show the function graphs in different colors, you can choose colors in the second column of the table.
The function is shown in the chosen color and the graph will also be drawn in this color.
If you don't want to draw all functions of the function table, you can turn some functions off.
To activate and inactivate functions, just click into the check boxes of the third column.
In Extcalc, you can use different function types, which you can choose in the fourth column.
Here you can choose normal functions, polar functions, parameter functions, 3D-Functions and inequalities.
You can also draw different types of functions at the same time, but you can only draw them into one coordinate system.
In the last column, you can switch the function to a dynamic function.

Output Window

If you press the print button, the graphs of all active functions will be drawn at the output window.
You can choose one type of coordinate system for your output window at the graphics menu or at the graphic preferences dialog.

The graph table of Extcalc can handle up to 20 functions. If you want to use save more functions or
if you want to sort the functions into different groups, you will have to use graph sets.

One graph set is created by default. It includes some example graphs. A new set can be created by choosing
Graphic -> Create New Set in the menu of the graphics window.

When you want to know the current graph set or change the graph set, you will have to ckick on Graphic -> Choose
Current Set. When you choose another set there, Extcalc will automatically store the current graph set and load
the new functions into the function table.

A graph set does not only include the functions. It also stores all relevant preferences for graph drawing so
that it is not necessary to change them after loading a new graph set.

Furthermore, there is a dialog for renaming and removing graph sets, which can be found in the graphics menu at
Graphic -> Manage Sets. When you want to save the current set under a different name, you can use Graphic -> Save
Current Set As but generally, loading and saving the sets will be done automatically.

Every graph set is stored in a seperate file. This files can be imported or exported so that you can
share them with others. Some examples can be downloaded from the Extcalc home page.

The described functions are not available in v0.9.3

If you want to analyze graphs, you can press the analyze button.
This will switch the graphics window into analysis mode where you can analyze your graphs.
Just choose one from the menu.
All analyzation methods expect Newton, integration and differentiation analyze only the the part of the graph which is shown in the output window.
You can only analyze the type of functions matching with your coordinate system type.
This means, if you want to analyze standard 2D-graphs, parameter graphs or graphs of inequality functions, you will have to choose a Cartesian 2D-coordinate system.
If you want to analyze polar functions, you will need a polar coordinate system and if you want to analyze 3D-graphs, you will have to choose the Cartesian 3D-coordinate system
The function type, which you want to analyze, can be chosen at the box below the function table.

Not all function types have the same analyzation options.
The table below shows you the different analyzation methods and the function types needed for this methods.

standard

polar

parameter

inequality

3D-graph

Nyquist plot

Calculate Y-value

x

x

x

x

x

x

Calculate roots

x

x

x

x

x

Newton's Method

x

x

x

Calculate X-values

x

x

x

x

x

x

Points of Intersection

x

x

x

Maximum and minimum values

x

x

x

Calculate Integral

x

x

x

x

Calculate Differential

x

x

x

x

x

Calculate Z-value

x

Function

Procedure

Calculate y-value

Insert a x-value into the input line or click into the graphics output window where you want to calculate the y-value.
Then press the calculate button.
The y-value of all displayed graphs will be shown in a table.
Parameter graphs may have more than one y-value with the same x-value.
For 3D-Graphs you have to insert x-value and z-value to calculate the y-value

Calculate Roots

Choose a function from the function box and press the calculate button to calculate the roots of a function.

Newton's Method

This is a special method of calculating roots.
You can set a start value for the calculation and the number of steps to calculate.
All results will be shown in the table. The first item in the last line is your result.

Calculate x-values

Choose a function from the box and type the y-value you want into the input line.
When you press the calculate button, the x-values are shown in the output table.
For 3D-graphs, the y-value is also needed for calculation.

Points of intersection

Choose two graphs from the boxes and press the calculate button.
Then the points of intersection of the two graphs are shown.
Don't choose two times the same function.

Maximum and Minimum values

Choose a graph and press the calculate button and then all extreme values will be calculated.

Integral Calculation

Just set a start point and an end point, then you can integrate the cosine function.
The size of the area between the graph and the x-Axis is calculated.
In 3D-Mode, you have to set X-Start, X-End, Z-Start and Z-End points for integration.
The volume between the X-Z-Plane and the graph is calculated.

Differential Calculation

For a differential calculation, you must choose a function and the point to calculate, then press the calculate button.
It is also possible to calculate the Cartesian differentiation of a parameter function.
For 3D-Functions, you have to set a X- and a Z-Value.
All partial differentials at the given point were calculated.

Calculate z-values

Choose a function from the box and type the x-value and the y-value into the input fields.
Pressing the calculate-button will show you the results.

If you choose the point Screenshot/Drawing in the box below the graphics area, you can save Screen shots and draw into the graphics window.

Saving a screenshot

In the window, shown above, you can save a screenshot of the graphics window. Before saving, you can change some options. You can set the size of
the picture, the image format and the file name. If you have set this, press the Save-button to save the image.

Drawing

If you want to point out something in the screenshot or if you want to make an annotation, Extcalc provides some drawing tools.
The drawing area is independent from the graphs and the coordinate system.
That means, when you change the coordinate system or redraw graphs, the extra drawn elements will not move or disappear.
The drawing functions have a preview mode.
While you hold down the mouse button, you can only see a preview.
The final view will be generated when you release the mouse button.
You can use several standard tools: free drawing, line, rectangle, circle
For each, you can change width and color.

Text drawing: If you press the text button, you will see an input dialog where you can set the text to draw.
When you hold down the left mouse button, you can also see a preview. If you press the mouse button again, the text will be inserted again.
To change the text, text size or color, you have to press the Text-button again.

Rubber: If you want to erase a part of the drawn things, you can use this tool. It makes the erased areas transparent. In preview mode, it is shown white.

Furthermore, you have an undo button and a button to clear the complete draw area.

In Extcalc, it is also possible to generate tables from functions.
The table window of Extcalc.

For the generation of this value tables, the same functions as for graphs will be used. You can generate tables
from every types of functions.
The tables are generated from the functions, which are activated in the function table. You can calculate
only tables from the type of functions, which is chosen at the type box. You can choose the table function type directly
with the box in the table window or by the table menu or by the table preferences dialog.
In the table preferences dialog, you can set the start and the end value for your table and you can choose the
number of values to calculate.
It is also possible to change the input values by clicking into the header of the table that shows the results.
You can insert the new input value into the shown dialog window.
For functions with the variable x or the complex z, on column per function is generated with the function values. For parameter
functions with the variable T, the same options as for the variable x are used. For every functions of this type,
one column with x-values and one column with y-values will be generated. If you generate a table with 3D-functions,
for every z-value of every function, one column will be generated.

The syntax for Extcalc scripts is similar to C-language syntax, but the normal calculator commands and operations can also be used in
this scripts.
You can't use all script commands in the normal calculator. Loops and the command to run another script can only be used in script,
not in the calculator.
The scripts programs run in a separate console, and you may use the other extcalc functions while running a script.
Scripts can be managed, edited and started from the integrated script editor.
In this version 0.9.3 are not all planned features included.

The integrated script editor includes all needed editor functions and you can use it to write, modify and run your scripts.

Before you can use this editor, you have to create the script directories. Normally, this is done at the first start of extcalc, but if you
haven't done it there, you may need use the script preferences dialog from the preferences menu to create them.
There you have to create a script root directory and set the names for a code subdirectory and a data subdirectory.
This new script code directory will contain some example scripts. Other example scripts can be found at the Extcalc homepage
extcalc-linux.sourceforge.net.

Create a New Script:

To create a new script you just need to write into an empty editor window and press the "Save"-Button, or you press the right mouse button
in the file list and choose "Create New Script".
The new file will then be shown in the editor window.

Load and Save Scripts:

To load a saved script, just choose it at the file list. The code will be shown in your editor window. If you have modified another code before,
this code will be marked as modified in the file list, but the changes will not be written to the disk.
If you want to save the current code, just press the "Save"-Button
If you want to save any other modified code, you can choose the code with the right mouse button at the file list and choose "Save" so save it.
If you want to save all modified codes, press the right mouse button at the file list and choose "save all".
Before closing Extcalc, you were asked if you want to save all your codes, if you have not saved any changes.

Import and Export Scripts

With the import function, you can copy a script from outside into the script code directory. With the export fuction, you
can copy it from the code directory to outside.
You can import and export scripts by pressing the import or export button of the script editor, or by using the script menu.
If you do this, you can see the import/export dialog where you can choose source and destination for copying.

Managing files:

Subdirectories:

You can create subdirectories in your script directory to save your scripts there.

Renaming:

You may also rename your scripts, but drag and drop for moving files is currently not available.

Removing:

You can also remove your code files and subdirectories, but you can remove directories only if they are empty.

Changes without Extcalc:

You can also modify your script files and directories without Extcalc.
If is running while you change something, you can press the right mouse button at the file list and choose "Update" to see your changes in Extcalc.

Running Scripts:

To run a script, just choose it from the file list and press the "Run"-Button.
Then, the script will be translated and the active window switches to the script console.
In the script console, you can see the interpreter errors. If the script was translated without errors, you can press the run-button to run the script.
It is not possible, to run two scripts at the same time. If you start another script while one is running, you were asked, if you want to
kill the currently running script.
You can always stop a running script by pressing the "Kill"-Button at the script console window.
If the script does not stop before the timeout, an error message is displayed. You have to press the kill-button again to stop the script correctly.

In version 0.9.3 of Extcalc, not all features are included. You can read more about the planned features
at Chapter 4.

Problems:

This is a list of the current problems of the 0.9.3 version of the Extcalc Script Interpreter

Speed
The extcalc scripts were ran by an Interpreter and so they run not as fast as compiled programms, but it will be optimized in later versions.

Variables:
You can use the uppercase letters from A to Z as variables. Every variable can also be used as an array or a matrix.

Features
Most of the planned features is available, now, but this is only a calculator script interpreter that can be used to solve simple mathematical problems.
It will never have the flexibility and power of a complex programming language like C.

Syntax:

The syntax of the Extcalc Script interpreter is similar to the C syntax.
Main Rules:

Every command ends with a ; semicolon

Behind loops and conditions directly follows the command to run, and no semicolon

If you want to run more than one command in a loop or a condition, you have to write this commands in braces {}.

It is possible to use mathematical operations in the code. They are also finished with the semicolon.

You can insert newlines, tabs and spaces everywhere in your code.

The whitespace will be removed before running the script.

It is possible to use C++-like comments // or C-comments. Everything in this line after the slash signs will be ignored.

You can also use the C-Comments /* ... */ in your scripts. Everything inside the comment will be ignored

The compare operator is written like in C with ==, the single = operator is the set-operator

If you want to use a Variable as an Array, use the Index-Operator with it. Example: A[3]=5;

It is not possible to define and functions. The commands are written directly into the code file.

It is possible to execute another script file by the run() command.

You can define macros with a #define line like in C, but only without arguments

Error Messages:

If you want to run a script in Extcalc, your script code is first processed by an script interpreter. This script interpreter generates
a executable object in the memory without executing it. This object can be ran as often as you want.
If this script interpreter is unable to process your code, it prints out an error message and the line, where the error was found.
But the interpreter doesn't have the original code format, so it can't exactly say, where to find the error in the code. The line number, which
the interpreter shows is calculated by searching for the semicolons in the code, so it may be that the shown error is above the shown line number.
Sometimes, the script interpreter may process a script without finding the errors inside. This happens, when the syntax is ok,
but the script contains logic errors.
If the console shows the error message "Preprocessor Error", it was unable to run the script interpreter. This may be because the file is empty, or because
the file does not contain anything translatable, or if the code contains a backlash outside of a string.
If there is a problem with the #config preferences or with #define macros, you will also get a "Preprocessor Error".

Variables:

You can use the uppercase letters from A to Z as variables.
When you prefer symboly names for your variables, you may want to define a macro like #define counter C.
This variables can be initialized directly in the code.
The variables are not pre-initialized, so the content is not defined. But they can always be used without initialization.
The variables can contain different types of content. The variable type may change in the running program.
The following types are available:

float:

floating point number of type long double (size depends on the system, normally 10 Bytes)

int:

integer number of type long long int (8 Byte)

bool:

boolean value of type bool (can be true or false)

string:

Text of type char* (length is variable, allocating and freeing is made by the interpreter)

If you set a variable with a floating point value, it will be of type float.
If you insert a integer value into the variable, it will be of type int.
Results from logic operations are of type bool.
Text, and input from the user is of type string.
If an operation fails, the variable will be set to NONE.
Every variable type contains a correct floating point value for compatibility with the normal calculator algorithms.

Arrays:

Every variable can also be used as an Array.
The normal value of the Array-Variable is stored at index 0.
If you use a Variable without Index-Operator, you use the element with index 0.
A=5 is the same as A[0]=5.
N-dimensional arrays were not supported in this version.
An array can only have one or two dimensions.
If you want to use a two dimensional array, you have to write two index operators.
For example A[3][2]=5;

Matrices and Vectors:

If you have filled a one-dimensional array, you can use this variable as a vector.
If you want to use a variable as a vector, you have to write for example A[] for the
variable A. If there is nothing inside the brackets, the variable is used as vector.
For every vector operation, including print a vector out, all vector elements were
converted to float.
Extcalc supports several vector operations:

Operation

Description

vector+constant, constant+vector, vector-constant, constant-vector

Add a constant value to every element of the vector

vector+vector, vector-vector

Vector sum. Elements with the same index were added

dotproduct: vector�vector

Multiply two vectors with a scalar as result

crossproduct: vector*vector

Multiply two vectors with a vector as result. Both vectors must have three elements.

vector*constant, constant*vector

Every element of the vector is multiplied with the constant.

For matrix operations, you have to fill a two-dimensional array.
You say that you want to use an array as a matrix, when you type for example A[][].
As at vector operations, all elements were converted to float.
If you access a single element of a vector for example by typing A[2][3], the first index
[2], is the line (2 means the third line), and the second index [3] is the row (3 means the fourth row).
Here is a list of supported matrix operations:

Operation

Description

matrix+constant, constant+matrix, matrix-constant, constant-matrix

Add a constant value to every element of the matrix

matrix+matrix, matrix-matrix

Matrix sum. Elements with the same indices were added

matrixproduct: matrix*matrix

Multiply two matrices. The result is also a matrix.

vector*matrix

Multiply a vector with a matrix. The result is a matrix.

matrix*vector

Multiply a matrix with a vector. The result is a vector.

matrix*constant, constant*matrix

Every element of the matrix is multiplied with the constant.

matrix^-1

Calculate inverse matrix

det matrix

Calculate determinant of a matrix.

General hints:

Matrices and vectors can be copied from one variable to another. You write for example
B=A[][] to copy the complete matrix A into B.

If you want to copy a single element of a Matrix A into B, write for example B=A[3][2].

When you write B=A, and A is a matrix, ONLY the first element of the matrix is copied. This is equal to B=A[0][0].

If you want to use the result Vector or result Matrix from the last operation, you can writ ans[] or ans[][].

The only way to make a matrix or a vector smaller, is to copy another, smaller vector or matrix into it.

When you want to erase all matrix an vector data, you must press th AC button.

Commands:

If you want to run more commands, they must be written in braces (without semicolon at the end).
Example:

if(A==5)
A=7;
else
{
A=A+1;
if(A>10)
A=0;
}

While
Syntax:

while( condition )
command that is ran while condition true;

If you want to run more commands, they must be written in braces (without semicolon at the end).
If the loop should run all time, you can write while(1), but you always have to set a condition
Example:

F=0;
while(F==0)
{
F=keystate;
sleep(10000);
}

For
Syntax:

for(initialization; condition; count-command)
command that is ran while condition true;

If you want to run more commands, they must be written in braces (without semicolon at the end).
At initialization, you can set the counter variable to the start value.
The loop runs, as long as the condition is true.
The printf-command is executed in every run. It can be any command.
If you don't need the initialization or the condition, you can only type a semicolon. If you don't need the count-command
you can leave it out.
Example:

for(A=-4;A<0;A+1->A)
print(A);
for(;;)
print("this runs always");

Print
Syntax:

print( Output );

Output can be a variable, a command or a constant (like text).
You can only set one input.
Example:

This command does only make sense, if you use the return value.
It doesn't block the program.
If no button was currently pressed, it returns 0.
The return value is a string and you may need to convert it.
Example:

The script is stopped for the given time.
If you want to make a program run slower, you should use this command and no empty loop.
A program that interacts with the user or a program that prints very much should use this command because
otherwise the script console may not have enough cpu time to show to show its content on time.
An example can be found at the keystate command.

readfile
Syntax:

readfile( filename );

Reads the file with the name filename and returns its content as string.
The files to read and write must be located in the script data directory. Subdirectories were not supported.
filename must be a string. if filename is no string, or the file could not be read, an empty string is returned.

writefile
Syntax:

writefile(filename , content);

Writes the content ans string into a file named filename.
If the file doesn't exsit, it will be created. If it exists, it will be cleared.
The filename must be a string. As at readfile, subdirectories and absolute paths were not supported.

appendfile
Syntax:

appendfile(filename , content);

The same as writefile, but if a file still exists, the content will be appended.
Example:

removefile("count.txt"); //remove file, if it exists
for(C=0; C<100; C++) //loop from 0 to 99
{
apendfile("count.txt",C); //write numbers from 0 to 99 into a file
appendfile("count.txt","\n"); //seperated by a newline
}

removefile
Syntax:

removefile(filename);

This command removes the file filename from the script data directory.

glshow
Syntax:

glshow;

This command updates the GL window.

glclear
Syntax:

glclear;

This command clears the GL window.

glbegin
Syntax:

glbegin( type );

This commands must be called to start drawing. It must also be called to draw into a dislplay list.
The draw type is also set by this command. The command is just written inside the brackets.
The following types can be set:
points
lines
linestrip
lineloop
triangles
trianglestrip
trianglefan
quads
quadstrip
polygon

glend
Syntax:

glend;

This command must be called after glbegin(), when drawing is done.

glbeginlist
Syntax:

glbeginlist;

This command starts a display list. After this command, all gl commands expect text drawing were stored in the
display list.

glendlist
Syntax:

glendlist;

This command ends the display list and returns the list ID.
The returned ID is an integer and must be stored to call the list.

glcalllist
Syntax:

glcalllist;

With this command, you can call a display list, so that it is drawn.
Using display lists instead of calling GL commands directly is much faster.

This command must be called to set object coodinates after calling glbegin().
Parameters are three floating point values for x-, y-, and z-coordinate.

glcolor
Syntax:

glcolor(r,g,b);

With this command, you can set the draw color.
The parameters are integer values for red, green and blue. They must be in a range between 0 and 255.

glmove
Syntax:

glmove(x,y,z);

This command moves a GL object.
The paramters are float values for the coordinates.
GL transformations were always multiplied to a single transformation matrix. This means, that the transformation command that has
been called first, will be done as last.

glrotate
Syntax:

glrotate(angle,x,y,z);

GL objects can be rotated by this command. The rotation is described by the angle in degrees (angle)
and by a vector (x,y,z), which represents the rotation axes. All parameters are of type float.
GL transformations were always multiplied to a single transformation matrix. This means, that the transformation command that has
been called first, will be done as last.

glscale
Syntax:

glscale(x,y,z);

With this command, a GL object can be scaled. All parameters are of type float.
GL transformations were always multiplied to a single transformation matrix. This means, that the transformation command that has
been called first, will be done as last.
Example:

This command shows a text at the 2D-position x,y. The start point is the upper left edge.
The coordinates are in pixels. x and y are integer values. Text can be a string or a number (float or int).

drawpoint
Syntax:

drawpoint(x,y);

This command draws a point of the currently set color into the 2D-graphics window of the script interpreter.
The origin of the coordinate system is the upper left corner of the window and x and y are integer values.

drawline
Syntax:

drawline(xstart,ystart,xend,yend);

This command draws a line of the currently set color from the given start point to the given end point.
All coordinates are integer values.

drawrect
Syntax:

drawrect(xstart,ystart,xend,yend);

Draws a rectangle with the given coordinates. All coordinate values are of integer type.

drawcircle
Syntax:

drawcircle(xstart,ystart,xend,yend);

Draws an ellipse into the rectangle defined by the given coordinates.
The coordinates are integer values.

drawstring
Syntax:

drawstring(x,y,text);

This command shows a text at the position x,y.
The coordinates are integer values. Text can be a string or a number (float or int).

drawcolor
Syntax:

drawcolor(r,g,b);

Sets the draw color for all 2D-drawing commands. The color is set by red, green and blue component which can
have values from 0 to 255.

drawclear
Syntax:

drawclear;

This command clears the 2D-graphics window of the script interpreter.

type converting
Syntax:

(target type)variable;

target type must be one of (int) (float) (string) (bool).
You can also use them with constants.
Example:

A=12.3545;
A=(int)A; // A is now 12
print((int)"abc"); //abc can not be converted to a number, so it is set to 97 (ASCII-Code of a)
C="234.45";
D=(float)C; //text can be interpreted as number, so it is set to the value
print(D+1); //prints 235.45

Running subprograms
Syntax:

run("script path");

With this command, you can execute another code file from your script.
The script path must be relative to the script code directory.
The script path must be hard coded in your script code
With this command, it is also possible to program a recursive algorithm. But you should not do that, because this
may lead to a stack overflow and the program will crash. The script interpreter can not prevent this crash.
Example:

run("subprogram"); //runs a subprogram with the name subprogram that is in the script code directory
runt("prog/routine4"); //runs a subprogram with the name routine4 which is in the directory prog

Every variable can also be an array, if you use the index-operator on it
Without index-operator, you always access the element with index 0.
If you want to access a single character of a string, you use the same syntax.
If you write one index, and the variable contains only a string at index 0, you access a character inside the string.
If you write two indices and the element at the first index is a character, you also access a character inside the string.
Example:

In script interpreter integrated operators (can be used with every variable type)
+ add
- sub
== compare
!= unequal
> greater
< less
>= greater or equal
<= less or equal
&& logic and
|| logic or
! logic not
= set (like in C)
-> set (like in Calculator)
[] index operator
[][] index operator matrix
All other operators can be used like in the calculator.

The operators can also be used together.

12.3545->A;
(int)A->A; // A is now 12
print((int)"abc"); //abc can not be converted to a number, so it is set to 97 (ASCII-Code of a)
"234.45"->C;
(float)C->D; //Text can be converted do a number, so D is set to this value
print(D+1); //prints 235.45

Script Preferences

It is possible to set special preferences for a script. This is often needed to guarantee that the script works, no matter how
the preferences made by the user are set.
This preferences don't change the user settings. They were only changed for the script, that is executed
This preferences are set inside the script code with the command #config.
The Syntax is:

The described functions are not available in v0.9.3

The Matrix/Vector window of Extcalc consists of several modules for matrix and vector calculations.
The top half of the window always shows the variable list with the 26 calculator variables and the answer memory and
the content of the current variable.
The variable memory used for matrix and vector calculation is the same as the memory used for the standard calculator.
The variables list shows size and type of every variable. The size can be changed within this list.
The table that shows the content of a variable and can be edited.

Modules

Here is a short description of the different matrix/vector calculation modules.

Calculator

This module has the same functions as the standard calculator. It is just smaller and located at the bottom right side of
the window. In this calculator, all matrix and vector functions can be used. The results are shown directly at the calculator
window, but they are also copied to the answer memory, which is part of the variables list.

Linear System of Equations

This modules can be used to solve linear systems of equations.
There are two possibilities to insert the parameters of the equations.
- coose a matrix of size n x (n+1) and insert all parameters into the matrix.
Example:
The equations to solve are:

4x - 2y = 9
-2x + 5y = -2

The matrix size would be 2 x 3
The matrix content would be:

4 -2 9
-2 5 -2

- choose a matrix of size n x n and a vector of size n
With the same example as above:
The matrix of size 2x2 would be:

4 -2
-2 5

The vector of size 2 would be:

9
-2

You can set the number of unknowns with the unknowns box. The chosen matrix and vector will be resized by pressing the set button.
The table at the bottom right side will show the result vector.
In this example, the result would be x=2.25 and y=0.75
The table would show:

2.25
0.75

If the linear system of equations could not be solved, because it has no valid results or infinitely mutch results, the last step
of the gauss algorithm will be shown at the table.
This can be used for further calculations.

Generate Matrix

With this module, you can create matrices and vectors with a predefined content.
You always have to choose the type of matrix or vector to create, and the variable that should be used.
The following things can be created:

Type

Description

Identity Matrix

Size n x n, the diagonal values are 1, the rest is set to 0. Identity of matrix multiplication.

Zero Matrix

Size n x m, all values 0.

Zero Vector

Vector Size n, all values 0.

- X-, Y-, Z-rotation matrix

Size can be 2 x 2 or 3 x 3. Generates a rotation matrix with the given angle.

Scaling Matrix

Size can be 2 x 2 or 3 x 3. Generates a scaling matrix with the given scale values.

Analyse Matrix/Vector

This module shows some information about the chosen variable.

Inverse Matrix

This module does the same as the calculator operation X[][]^-1.
It calculates the inverse matrix of the chosen variable, if possible, and shows it at the table.

The statistics window of Extcalc serves modules for statistical analyzation of tables of values or point coordinates.
At all modules, the result can be shown graphically by pressing the print-button.

Approximate

This module lets you calculate approximated functions from a list of points. To calculate the function, a function type and the list
(1 to 5) that contains the points data must be chosen. The result function can be shown by pressing the calculate button. To copy the
function into the global function list, choose a function list entery and press the copy button.
The following functions can be used for approximation:

function

Description

const

Constant value. This calculates the mean of the given y-values.

a*x+b

Straight line. The line is approximated by least square regression.

a*x^2+b*x+c

Quadratic equation. The points data is approximated by a quadratic function using least square regression.

a*e^(b*x)

e-function. Approximates the given points by a e-function using least square regression.

a*b^x

Exponential function. Approximates the given points by a exponential function using least square regression.

Interpolate

This module calculates the interpolation graph for a given list of points. The interpolation graph is a polynomial that includes
every given point. The result function will become very large, if more interpolation points were given.

Show Line-Graph

This module shows a graph of all given points connected by lines. You just have to choose the input list and press the print button.

Normal Distribution Graph

With this module, a gaussian normal distribution graph can be calculated. As input data, it needs a list of values (no points!).
To calculate the normal distribution function, just choose an input data column with the input box and press the calculate button.
The graph can also be shown by pressing the print button.

Distribution Graph

This module prints a graph of the distribution of a list of values (no points). The number of steps can also be set.
Press the print button to see the graph.

Preferences can be changed directly by using the menu item "Calculator" for calculator preferences
and the item "Graphic" for the preferences of the graphics window or
by the preferences dialogs. You find them at the "Preferences"
menu-point.

Calculator Preferences Dialog

In this dialog, you can set the calculator mode and the output format. The calculator mode (scientific or base mode) only
refers to the
calculator window. The output format preferences, output length and output type, change the output format
of the complete program. The angle type is also set for the complete program. All these preferences can also be set
by the preferences menu.

Graphics Preferences Dialog

The graphics preferences are seperated to three tabs.

Coordinate Systems

Here you can set the coordinate system type, the sizes of the coordinate systems, and the look of them.
There are two buttons to set standard values for the coordinate system sizes. The "Standard"-Button sets standard values
which make sense for most graphs. The "Trigonometric"-Button sets the coordinate system to special values to show trigonometric
functions like sinus and cosinus optimally. This values depend on the current angle type.
The maximum radius and the maximum angle of the polar coordinate system can only be positive values.
Furthermore, there are some options depending the look. The axis, the raster and the labels can be switched on and off and
the coordinate systems width-to-hight-ratio can be scaled equal to the size of the x- and y-axes.

Parameter Range

For some graphs were parameter needed, which don't depend on the coordinate system size.

Parameter T:
This one is needed for parameter functions. You can set its start and end point, here. Remember that if you set the
range too wide, you will not see most of the calculated graph, and the visible part will not be shown precise
enough.

Parameter Z:
This parameter is only for 2D-Nyquist-Plots. 3D-Nyquist plots use the Z-axes of the coordinate system.
You have two modes, to set this parameter's range. The standard is logarithmic scale, which means, that if you set the range to -3 ... 3,
the parameter runs from 10^-3 to 10^3 with logarithmic scale.This is the best for the most nyquist plots. If you switch logarithmic
scale off, the parameter runs from the start to the end value in equal steps.

Parameter A:
This is the parameter for all dynamic graphs. First, you have to set the start and the end value. Then you must set the
number of steps to calculate. If you want to show an animation, you will have to set about 30 steps. You should
not set so much steps, when you use single step mode. As next, you can choose, whether the parameter should only be counted in one
direction, or whether it should be counted up and down. If you have selected automatic mode, you can also set the delay time.
For animations, 3 (=30ms) is a good value.

Precision/Performance

In this dialog, you can set the steps for graph calculation and the precision of some graph analysis functions.
Normally, it is not needed to change the steps count for 2D-graphs. It can be increased, if details of a graph, for example
an asymptote, are not shown correctly.
The number of steps of the 3D-graph is equal to the number of grid lines that show the graph. Remember, that if you increase
this value, the number of points to calculate raises by the power of two.
The graph analysis presition should also be increased only if details are calculated wrong. It does not increase the
precision of the results themselve, because they are always calculated as exact as possible.

Table Preferences

If you want to calculate a table of function values, you can set the start value, end value and number of values, here.
The function type, for which the table is calculated, can be set here or in the table preferences menu.

Scripting Preferences

Here you can set the path to the script root directory. This directory contains two subdirectories, one for the code
files and one for the data files. Their names can also be set in this dialog.

Version

Extcalc version 0.9.3
This is a beta-version of Extcalc.
This means, that there may be some bugs in this program, because the new features from the earlier version have to be tested.
Further information to the beta version can be found on the projekt homepage.

Precision

The maximum precision of Extcalc on a 32-bit PC-Processor is 18 decimal digits
because it uses double-variables for calculation. Because of the architecture of a normal
PC-Processor, the last digit is often calculated wrong.
The precision of the integration-operation is about 9 digits and the precision of the
differentiation-operation is about 8 digits depending on the formula to calculate.
The precision of trigonometric functions and logarithms is about 17 digits.

To-do-list

beta testing

Tested Distributions:

Suse Linux 11.2:

OK

Debian Lenny:

OK

Ubuntu 9.10

OK

Mandriva 2010:

OK

Fedora Core 12:

OK

FreeBSD 6.2:

read comment

FreeBSD 6.2

The source can be built under FreeBSD, when the development packages of QT and OpenGL were installed.
You may need to set the QTDIR environment variable to installation path of the QT development package.

Needed software:

Linux
GCC 4
Qt 4.3 or higher
OpenGL
CMake (source packet only)

Needed hardware:

CPU at about 1GHz (32Bit or 64Bit)
enough RAM to run X
For 3D-graphics, a 3D-graphics card is recommended
A mouse with mouse wheel is needed for zooming, moving and rotating graphs