ARTS  2.0.49
test_complex.cc
Go to the documentation of this file.
1 /* Copyright (C) 2002-2008 Stefan Buehler <sbuehler@ltu.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
26 #include <iostream>
27 #include "complex.h"
28 
29 void test01()
30 {
31  Complex a;
32  Complex b (3., 0.);
33 
34  //cout << "a = " << a << "\n";
35  cout << "b = " << b << "\n";
36 
37  a = b;
38  cout << "a = " << a << "\n";
39 
40 
41  a = Complex (1., 1.);
42  cout << "a = " << a << "\n";
43  cout << "a.abs() = " << abs (a) << "\n";
44  cout << "a.arg()= "<< arg (a)*57.2957914331333 <<" degree"<< "\n";
45 
46 
47  Complex c;
48  c = a + b;
49  cout << "c = " << c << "\n";
50 
51  cout << "a += b: " << (a += b) << "\n";
52 
53  cout << "c + 3 = " << (c + 3.) << "\n";
54 
55  cout << "c + 3i = c + Complex (0,3) = " << (c + Complex (0., 3.)) << "\n";
56 
57  Complex d;
58  a = Complex (1., 1.);
59  b = Complex (-1., -1.);
60  d = a * b;
61  cout << "d = " << d << "\n";
62  Complex e;
63  e = a / b;
64  cout << "e = " << e << "\n";
65  Complex f;
66  f = pow(a,0)+pow(b,0);
67  cout << "f = " << f << "\n";
68  Complex g;
69  g = pow(a,1)+pow(b,1);
70  cout << "g = " << g << "\n";
71  Complex h;
72  h=pow(a,2)+pow(b,2)+pow(a,3)+pow(b,3);
73  cout << "h = " << h << "\n";
74 }
75 
76 int main()
77 {
78  test01();
79  return 0;
80 }
complex.h
A class implementing complex numbers for ARTS.
abs
#define abs(x)
Definition: continua.cc:13094
main
int main()
Definition: test_complex.cc:76
test01
void test01()
Definition: test_complex.cc:29
Complex
complex< Numeric > Complex
Definition: complex.h:32
complex
Definition: continua.cc:12953