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:
If abc is an operator, the result will be:
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:
which would mean in MathML:
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.