numerix_doc 0.4
complex_test.cpp
/******************************************************************************
* MODULE     : complex_test.cc
* DESCRIPTION: Test complexified numbers
* COPYRIGHT  : (C) 2005  Joris van der Hoeven
*******************************************************************************
* This software falls under the GNU general public license and comes WITHOUT
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
* If you don't have this file, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/

#include <numerix/complex_double.hpp>
using namespace mmx;

#define Complex complex<double>

int
main () {
  Complex u (7, 3);
  Complex v (1, 2);
  mmout << "u\t= " << u << "\n";
  mmout << "v\t= " << v << "\n";
  mmout << "conj(u)\t= " << conj(u) << "\n";
  mmout << "norm(u)\t= " << norm(u) << "\n";
  mmout << "u+v\t= " << u+v << "\n";
  mmout << "u-v\t= " << u-v << "\n";
  mmout << "v-u\t= " << v-u << "\n";
  mmout << "u*v\t= " << u*v << "\n";
  mmout << "2*u\t= " << 2*u << "\n";
  mmout << "u*2\t= " << u*2 << "\n";
  mmout << "u/3\t= " << u/3 << "\n";
  mmout << "1/v\t= " << 1/v << "\n";
  mmout << "u/v\t= " << u/v << "\n";
  mmout << "v/u\t= " << v/u << "\n";
  mmout << "(v*v)/u\t= " << (v*v)/u << "\n";
  mmout << "u+=v\t= " << (u+=v) << "\n";
  mmout << "u-=v\t= " << (u-=v) << "\n";
  mmout << "u*=v\t= " << (u*=v) << "\n";
  mmout << "u/=v\t= " << (u/=v) << "\n";
  mmout << "u*=11\t= " << (u*=11) << "\n";
  mmout << "u/=11\t= " << (u/=11) << "\n";
  mmout << "u=v\t= " << (u==v) << "\n";
  mmout << "u!=v\t= " << (u!=v) << "\n\n";

  mmout << "abs(u)=\t" << abs (u) << "\n";
  mmout << "arg(u)=\t" << arg (u) << "\n";
  mmout << "exp(u)=\t" << exp (u) << "\n";
  mmout << "log(u)=\t" << log (u) << "\n";
  mmout << "cos(u)=\t" << cos (u) << "\n";
  mmout << "sin(u)=\t" << sin (u) << "\n";
  return 0;
}
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines