Merge branch 'OOP' of https://scm.cri.ensmp.fr/git/Faustine into OOP
[Faustine.git] / dsp_files / tests / complex_test.dsp
1 import ( "complex.lib" ) ;
2
3 ccplx(r, i) = r, i : carte_cplx;
4 pcplx(m, a) = m, a : polar_cplx;
5
6 A = ccplx(0.2, 0.3);
7 B = ccplx(-0.4, 0.5);
8 C = pcplx(0.5, PI);
9 D = pcplx(0.2, PI/2);
10
11 //process = C, D : pcplx_add; //(0.53852, 2.7611)
12 //process = C, D : pcplx_sub; //(0.53852, -2.7611)
13 //process = C, D : pcplx_mul;//(0.1, -1.5708)
14 //process = C, D : pcplx_div;//(2.5, 1.5708)
15 //process = 0.3, (0, 0.5 : -) : par(i, 2, sca2pcplx);//(0.3, 0), (0.5, 3.14)
16 //process = 0, 0.4 : - : sca_abs;//(0.4)
17 //process = 0, 0.4 : - : sca2pcplx;//(0.4, -0.86)
18 //process = 1, (PI/4*3) : polar_cplx : polar2carte;//(-0.707, 0.707)
19 process = (0, 0.5 : -), 0 : carte_cplx <: _, carte2polar;//(0.5, 0.71)
20
21 //process = C, D <: (polar2carte, polar2carte : ccplx_mul : carte2polar), pcplx_mul : pcplx_sub;