Project

General

Profile

Wiki » History » Version 5

Thomas Capricelli, 11/18/2009 04:55 PM

1 1 Thomas Capricelli
Symia is a piece of software that helps programmers to perform "symbolic computation":http://en.wikipedia.org/wiki/Symbolic_computation, also known as *symbolic calculs*. The main characteristics are
2
* Symia is a library : the target audience is programmers.
3
* Symia is written in C++.
4
* Symia is released under the "GNU Lesser General Public License":http://en.wikipedia.org/wiki/LGPL, so that even close-source software can make use of it.
5 2 Thomas Capricelli
* Symia uses "unit tests":http://en.wikipedia.org/wiki/Unit_testing as a mean to prevent regression, to ensure robustness, and to provide working examples that the user can rely on.
6 1 Thomas Capricelli
7
The only other C++ library we are aware of is "Ginac":http://en.wikipedia.org/wiki/GiNaC, which is released under the "GNU General Public License":http://en.wikipedia.org/wiki/Gpl, which prevent it from being used in the industry.
8
9 2 Thomas Capricelli
Symia is far from being able to do as much as, say, Maple or Ginac, but if your needs are basic, you can rely on the robust and "tested":http://en.wikipedia.org/wiki/Unit_testing Symia library.
10 1 Thomas Capricelli
11 2 Thomas Capricelli
Symia is released by "Sylphide Consulting":http://www.sylphide-consulting.com. If you need some more features in Symia, you can either abandon the idea of using Symia, implement the missing features by yourself (and provide the code back, as the "GNU LGPL":http://en.wikipedia.org/wiki/LGPL says), or pay someone to do the job. Of course, *Sylphide Consulting* is an obvious choice for such a task, and we would be delighted if you "contact us":http://www.sylphide-consulting.com/contact about it.
12 3 Thomas Capricelli
13
14
h1. Design
15
16
Quite simple and classical, see the "class diagram":http://labs.freehackers.org/embedded/symia/inherits.html
17
18
h1. Examples
19
20 4 Thomas Capricelli
The following code highlights the most important features of Symia.
21 3 Thomas Capricelli
22
<pre><code class="c">
23
{
24
    Expression x("x"), y("y"), a("a"), b("b"), c("c"); // create symbols
25
26
    // Operators and most classical functions are overloaded, so you can construct
27
    // complex expression as usual.
28
    Expression e = a*x+b*x*x*exp(-c*(x+1)/(x*x));
29
30
    // Helpers are provided to display an expression
31
    // e_as_text is "a*x+b*x*x*exp(-c*(x+1)/(x*x))" as expected
32
    QString e_as_text = e.toString(); 
33
34
    // You can substitute an whole expression to any symbol
35 5 Thomas Capricelli
    e = e.replace(x, b+log(c))
36 3 Thomas Capricelli
    // e now is "a*(b+log(c))+b*(b+log(c))*(b+log(c))*exp(-c*(b+log(c)+1)/((b+log(c))*(b+log(c))))"
37
    // yes, this is ugly, and this is the reason what you are happy a computer handles that for you.
38
39
    // Evaluation is about using replace() as well
40
    e = e.replace(a,-3).replace(c,1).replace(b,.78);
41
    // e now is "-2.31455"
42
}
43
</code></pre>