# The &kalgebra; Handbook

Aleix Pol

    &Aleix.Pol.mail;

2007 &Aleix.Pol;
&FDLNotice;
2009-11-8
0.9 (&kde; 4.4.0)

&kalgebra; is a mathematical calculator based on content markup MathML language. Nowadays it is capable to make simple MathML operations (arithmetic and logical) and to representate 2D and 3D graphs. It is actually not necessary to know MathML to use &kalgebra;.

KDE kdeedu graph mathematics 2D 3D mathML

## Introduction

&kalgebra; is a MathML-based graph calculator. Although it was initially MathML oriented it can now be used by everyone with little mathematic knowledge.

Here's a screenshot of &kalgebra; main window
&kalgebra; main window

&kalgebra; main window consists in a Console tab, a 2D Graph tab, a 3D Graph tab and a Dictionary tab. Below these tabs you will find an input field to type your functions or do your calculations.

## Syntax

If we want to understand how it works, the best thing we can do is to realize that our input is being converted into MathML although it is not necessary to know MathML. I have based the syntax basically on common sense, it should not be hard for anyone, I’ve looked closely to maxima and maple’s syntax so they look very similar.

Here is a list of the available operators we have by now:

- + - * / : Addition, subtraction, multiplication and division.

- ^, **: Power, you can use them both. Also it is possible to use the unicode ² characters. Powers are one way to make roots too, you can do it like: a**(1/b)

- -> : lambda. It’s the way to specify the bounded variable in a function.

- x=a..b : This is used when we need to delimitate a range (bounded variable+uplimit+downlimit). This means that x goes from a to b.

- () : It is used to specify a higher priority.

- abc(params) : Functions. When the parser finds a function, it checks if abc is an operator. If it is, it will be treated as an operator, if it is not, it will be treated as a user function.

- := : Definition. It is used to define a variable value. You can do things like x:=3, x:=y being y defined or not or perimeter:=r->2*pi*r.

- ? : Piecewise condition definition. Piecewise is the way we can define conditional operations in &kalgebra;. If we introduce the condition before the '?' it will use this condition only if it is true, if it finds a '?' without any condition, it will enter in the last instance. Example: piecewise { x=0 ? 0, x=1 ? x+1, ? x**2 }

- { } : MathML container. It can be used to define a container. Mainly useful for working with piecewise.

- = > >= < <= : Value comparators for equal, greater, greater or equal, less and less or equal respectively

Now you could ask me, why should the user mind about MathML? That’s easy. With this, we can operate with functions like cos(), sin(), any other trigonometrical functions, sum() or product(). It does not matter what kind it is. We can use plus(), times() and everything which has its operator. Boolean functions are implemented as well, so we can do something like or(1,0,0,0,0).

## Using the Console

&kalgebra;'s console is useful as a calculator. There you have a list of the declared variables. By double clicking on them you will see a dialog that lets you change their values (just a way to trick the log). Every time you enter an expression, the "ans" variable value will be changed to the last result.

Examples:

- sin(pi)

- k:=33

- sum(k*x : x=0..10)

- f:=p->p*k

- f(pi)

Menu options:

&Ctrl; N New

  Flushes the log.

&Ctrl; L Load Script

  Executes the instructions in a file sequentially. Nice if you want to define some libraries or resume some previous work.

&Ctrl; G Save Script

  Saves the instructions you have typed since the session began to be able to reuse. Generates text files so it should be easy to fix using any text editor, like Kate.

&Ctrl; S Save Log

  Saves the log with all results into an HTML file to be able to print or publish.

&Ctrl; Q Quit

  Shuts the program down.

## 2D Graphs

To add a new 2D graph on &kalgebra;, what you have to do is to go to the 2D Graph tab and click in the Add tab to add the new function. Then your focus will go to an input text box where you can type your function.

### Syntax

If you want to use a typical f(x) function it is not necessary to specify it, but if you want a f(y) or a polar function, you will have to add y-> and q-> as the bounded variables.

Examples:

- sin(x)

- x²

- y->sin(y)

- q->3*sin(7*q)

- t->vector{sin t, t**2}

If you have entered the function click on the OK button to display the graph in the main window.

### Features

You can set several graphs on the same view. Just use the Add button when you are in List mode. You can set each graph its own color.

The view can be zoomed and moved with the mouse. Using the wheel you can zoom in and out. You can also select an area with the left button of the mouse and this area will be zoomed in. Move the view with the arrow keys.

In the List tab, you can open a context menu with a &RMB; click on a function and hide or remove it.

In the 2D Graph menu you find these options:

- Show or hide the grid

- Keep the aspect ratio while zooming

- Zoom in (&Ctrl; +) and zoom out (&Ctrl; -)

- Save (&Ctrl; S) the graph as image file

- Reset the view to the original zoom

- Select a resolution for the graphs

## 3D Graphs

To draw a 3D Graph with &kalgebra; you will have to go to the 3D Graph tab and you will see an input field at the bottom where you will type your function. Z can not be defined yet, for the moment &kalgebra; only supports implicit 3d graphs dependent only on the x and y, such as (x,y)->x*y, where z=x*y.

Examples:

- sin(x)*sin(y)

- x/y

The view can be zoomed and moved with the mouse. Using the wheel you can zoom in and out. Hold the &LMB; and move the mouse to rotate the graph.

The left and right arrow keys rotate the graph around the z axis, the up and down arrow keys rotate around the horizontal axis of the view.

In the 3D Graph menu you find these options:

- Enable or disable transparency

- Save (&Ctrl; S) the graph as image file

- Reset the view to the original zoom

- Draw the graphs with dots, lines or solid

## Dictionary

The dictionary is a collection of all &kalgebra; available operations. It can be useful to check in the dictionary what is an operation useful for and to know how many parameters does a function stand for.

## Credits and License

- Program copyright 2005-2009 &Aleix.Pol;

Documentation copyright 2007 &Aleix.Pol; &Aleix.Pol.mail;

&underFDL; &underGPL;

## Installation

### How to obtain &kalgebra;

&install.intro.documentation;

### Compilation and installation

&install.compile.documentation;
&documentation.index;