Since we (Victor mainly) are working on KAlgebra’s documentation, I’ve decided to write a bit about the syntax. As I said in the other post, we can enter formulae in two ways. MathML Content Markup and my invented syntax (perhaps I’d have to invent a weird name for it xD).

If we want to understand how does it work, the best thing we can do, is to realize that our input is being converted into MathML, it’s not necessary to know it by the way. I’ve based the syntax basically on common sense, shouldn’t be hard for anyone, I’ve looked closely to maxima and maple’s syntax to use it so they are very similar.

I’ll make a list about the operators we have by now:

- + – * / : Obvious, add, substract (the unary and binary them both), multiplication and division.
- ^ or **: Power. One way to make roots too, you can do it like: a**1/b
- -> : lambda. It’s the way to specify the variable in a function. Its not yet fully implemented in console, but it is useful in 2D graphs, where we can write y->sin(y) and this function will depend on Y, instead of X, which is the default lambda.
- x=a_b : This is used when we need to delimitate a range (bvar+uplimit+downlimit). This means that x goes from a to b.
- () : It is used to specify a higher priority.
- abc(params) : Functions. This is _very_ important using KAlgebra, and most users don’t know it.

I’m going to focus in the last point. I’ll keep using abc(params) example. When parser finds a function, it checks whether abc is an operator or not. Ifit is, it’s going to be treated as an operator, if it’s not, it will be treated as a function. So, if abc is not an operator, the result will be like this:

<apply>

<ci type="function">abc</ci>

...params...

</apply>

If abc is an operator, the result will be:

<apply>

<abc />

...params...

</apply>

Now you could ask me, what does the user mind about MathML? That’s easy. with this, we can operate with functions like cos(), sin() or any other trigonometrical functions, sum(), product(). Doesn’t matter what kind it is. We can use plus, times and the other ones that have its operator, it will make calcolus faster (you can check it if you want to calc in the 3D graph x+x+x+x+x+x and plus(x,x,x,x,x,x) and you will see that the second one is quite faster, you can compare outputs too). Boolean functions are implemented too, so we can do something like and(1,0,0,0,0) or so. There is a list with the implemented operators in KAlgebra’s berlios.de site.

The x=a_b operator needs a bit of explanation too. It’s only used with sum() and product() operators and it behaves like this:

`sum(x=1_100, x+1)`

which would mean in MathML:

```
```<apply>
<sum />
<bvar><ci>x</ci></bvar>
<uplimit><cn>1</cn></uplimit>
<downlimit><cn>100</cn></downlimit>
<apply>
<plus />
<ci>x</ci>
<cn>1</cn>
</apply>
</apply>

This operator is probably going to be changed into x=a..b so it is like in Maple.

I hope it is understandable, if you don’t, tell me and if you want me to explain something else, tell me too and I’ll try to write about it.

An idea:

You could to upload the source on a webpage and highlight the sintax (it r0x0r my b0x0r xD), so when you are telling us the operators or everything else you could to link to the lines of what code/function does it.

You will teach us how it works and how it’s encoded.

Tsuki des kalgebra ðŸ™‚ (I like kalgebra)

Hmmm, look, I’ve got a better idea, in the next KAlgebra article I’ll talk about how to find those things without falling lost between so many files… you can pick the source code and look at it, that’s all placed on qexp.h and qexp.cpp and you can use Kate to highlight it :P.

You can check the source code on the svn repository… I’m trying to keep it up to date… http://svn.berlios.de/wsvn/kalgebra/trunk/?rev=0&sc=0

It has syntax highlighting and so…

Idea for the name of your weird-and-stupid-language:

WASLE : Wierd And Stupid Language Extensive-vocal-for-suporting-pronunciation

Excelent, isn’t it?

Cya!