//*********************************************************** // // NXV4 "Math-on-Paper" software // // package : CPX class _____________________________________ // // supports: move semantix // operators + - * / ^ L,R-val context // += -= *= /= // fabs() // phi () [ 0 ... 2.pi] o/p // phi2() [-pi ... +pi] o/p // ~ - unary operators L,R-val // cpx i.e. int // float // double // long double // type_casts between the types // cout << overload // // TOTAL = 27+1205 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 : CPX4/v1.0.alfa / Mon Dec 27 17:13:57 CET 2021 // v2.1.beta / Mon Mar 07 12:45:54 CET 2022 // //*********************************************************** #include #include #include "cpx.hh" using namespace std ; using namespace cpx4 ; int main() { // this is an application example in electronics // // RC pi bandpass filter // // o----||-----/\/\/\---------o // C1 | R2 | // | | // \ --- // / --- // \ | // / R1 | C2 // \ | // / | // | | // | | // === === // // here we form Z = R1 // (R2+C2) and calculate // from there on, the voltage division between // C1 and Z (and R2, C2). // // to use this example do the following: // rm test.cc // ln -s e1.cc test.cc // make test // make run using dblx = double ; using real = long double ; double e = exp(1) ; double pi = 3.14159265853 ; cpx j(0,1) ; dblx R1 = 0.1e3 ; // 0.1 kOhms dblx C1 = 3.3e-9 ; // 3.3 nF dblx R2 = 1.0e3 ; // 1.0 kOhms dblx C2 = 1.0e-9 ; // 1.0 nF dblx min = 10.0e0 ; // Hz dblx max = 10.0e6 ; // Hz int N = 10000 ; // nr. points log scale for (int i=0; i