//*********************************************************** // // NXV4 "Math-on-Paper" software // // package : MTX class _____________________________________ // // supports: move semantix // operators + - * / L,R-val context // += -= *= /= // fabs() // ~ - unary operators L,R-val // mtx i.e. int // float // double // real // cpx // cpx // cpx // cpx // type_casts between the types // cout << overload // // TOTAL = 5084 instantiated op/f's // _____________________________________ // // // authors : Mihai-Tiberiu Dima (1) // Maria Dima (2) // // Meshcheryakov Laboratory of Information Techn. // Joint Institute for Nuclear Research // Dubna-Russia // // on leave from: // // Hyperion Univ. Bucharest-Romania // // // date : MTX4/v1.0.alfa / Mon Mar 07 12:45:54 CET 2022 // //*********************************************************** #include #include #include "cpx.hh" #include "vec.hh" #include "mtx.hh" using namespace std ; using namespace cpx4 ; using namespace vec4 ; using namespace mtx4 ; int main() { // vec4::utf8x = true ; // mtx4::utf8x = true ; // this is a special math example // // In Lie representation group elements // are exp(gen). // // | 0 1 0 | // for Lz = |-1 0 0 | // | 0 0 0 | // // then rotations around the z-axis are: // // ROT = exp(phi*Lz) // // to use this example do the following: // rm test.cc // ln -s e2.cc test.cc // make test // make run using fltx = float ; using dblx = double ; using real = long double ; double e = exp(1) ; double pi = 3.14159265853 ; mtx Lz( 0, 1, 0, -1, 0, 0, 0, 0, 0 ) ; cout << endl ; cout << noboolalpha << endl ; cout << endl ; cout << " _____________________________________" << endl ; cout << endl ; cout << endl ; cout << endl ; cout << " " << boolalpha << "ROT = exp(phi*Lz) = " << exp(pi/4*Lz) << endl << endl << endl ; cout << endl ; cout << " " << "ROT( |ex> ) = " << (exp(-pi/4*Lz)|vec(1,0,0)) << endl ; cout << endl ; cout << endl ; cout << endl ; cout << " " << "GEN = log(ROT) = " << log(exp(-pi/4*Lz))*4/pi << endl <