Symia是一个帮助程序员进行符号演算的C++++ 库,该库没有用户界面图形或文字。
Symia主要特点:
1、Symia是程序员目标对象的一个库。
2、Symia是采用C++编写。
3、Symia是GNU通用公共许可证下发布,无源码软件也可以利用它。
4、Symia使用单元测试以防止回归,以确保稳健性,并提供工作的例子给用户参考。
Symia 0.4该版本修复了几个重要的错误。最重要的是一些内存泄漏问题已修复。
软件信息:http://labs.freehackers.org/projects/symia/wiki
使用范例:
1 { 2 Expression x("x"), y("y"), a("a"), b("b"), c("c"); // create symbols
3
4 // Operators and
most classical
functions are overloaded, so you can construct
5 // complex expressions the way you expect.
6 Expression e = a*x+b*x*x*exp(-c*(x+1)/(x*x));
7
8 // Helpers are provided to display an expression
9 std::string e_as_text = e.toString();
10 // now e_as_text is "a*x+b*x*x*exp(-c*(x+1)/(x*x))"
11
12 // You can substitute an expression to any symbol
13 e = e.replace(x, b+log(c))
14 // 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))))"
15 // yes, this is ugly, and this is the reason why you are happy a computer handles it for you.
16
17 // Evaluation is about using replace() as well
18 e = e.replace(a,-3).replace(c,1).replace(b,.78);
19 // e now is "-2.31455"
20
21 // symia provides a way to compute the derivative with respect to a symbol:
22 e = sqrt(a+log(x)*b)+exp(cos(x));
23 e = e.derivative(x);
24 // e now is "b/x*
0.5/sqrt(a+log(x)*b)-sin(x)*exp(cos(x))"
25
26 }