home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CTECHAPP.ZIP / CLASSES.ZIP / CP_TRIG.CPP < prev    next >
C/C++ Source or Header  |  1990-01-28  |  1KB  |  73 lines

  1. //  Module:     Cp_trig
  2. //  Version:    2.20
  3. //
  4. //  Language:   C++ 2.0
  5. //  Environ:    Any
  6. //
  7. //  Purpose:    Trignometric functions for Complex class
  8. //
  9. //  Written by: Scott Robert Ladd
  10.  
  11. #include "Complex.hpp"
  12.  
  13. extern "C"
  14.     {
  15.     #include "math.h"
  16.     #include "stdlib.h"
  17.     }
  18.  
  19. // trigonometric methods
  20. Complex cos(const Complex & c)
  21.     {
  22.     Complex result;
  23.  
  24.     result.Real =  cos(c.Real) * cosh(c.Imag);
  25.     result.Imag = -sin(c.Real) * sinh(c.Imag);
  26.  
  27.     return result;
  28.     }
  29.  
  30. Complex sin(const Complex & c)
  31.     {
  32.     Complex result;
  33.  
  34.     result.Real = sin(c.Real) * cosh(c.Imag);
  35.     result.Imag = cos(c.Real) * sinh(c.Imag);
  36.  
  37.     return result;
  38.     }
  39.  
  40. Complex tan(const Complex & c)
  41.     {
  42.     Complex result = sin(c) / cos(c);
  43.  
  44.     return result;
  45.     }
  46.  
  47. Complex cosh(const Complex & c)
  48.     {
  49.     Complex result;
  50.  
  51.     result.Real = cos(c.Imag) * cosh(c.Real);
  52.     result.Imag = sin(c.Imag) * sinh(c.Real);
  53.  
  54.     return result;
  55.     }
  56.  
  57. Complex sinh(const Complex & c)
  58.     {
  59.     Complex result;
  60.  
  61.     result.Real = cos(c.Imag) * sinh(c.Real);
  62.     result.Imag = sin(c.Imag) * cosh(c.Real);
  63.  
  64.     return result;
  65.     }
  66.  
  67. Complex tanh(const Complex & c)
  68.     {
  69.     Complex result = sinh(c) / cosh(c);
  70.  
  71.     return result;
  72.     }
  73.