SyFi
0.3
|
00001 #include <iostream> 00002 #include <cassert> 00003 using namespace std; 00004 00005 #include <symbol_factory.h> 00006 using namespace GiNaC; 00007 using namespace SyFi; 00008 00009 00010 int main() { 00011 initSyFi(3); 00012 assert( symbol_exists("x") ); 00013 assert( symbol_exists("y") ); 00014 assert( symbol_exists("z") ); 00015 00016 ex x1 = get_symbol("x"); 00017 ex x2 = get_symbol("x"); 00018 ex x3 = get_symbol("x"); 00019 assert( is_zero(x2-x1) ); 00020 assert( is_zero(x3-x1) ); 00021 00022 assert( is_zero( SyFi::x - get_symbol("x") ) ); 00023 assert( is_zero( SyFi::y - get_symbol("y") ) ); 00024 assert( is_zero( SyFi::z - get_symbol("z") ) ); 00025 assert( !symbol_exists("foo") ); 00026 00027 cout << get_symbolic_vector(1, "v") << endl; 00028 cout << get_symbolic_vector(3, "u") << endl; 00029 cout << get_symbolic_vector(11, "w") << endl; 00030 cout << get_symbolic_matrix(2, 3, "B") << endl; 00031 cout << get_symbolic_matrix(3, 3, "A") << endl; 00032 00033 return 0; 00034 }