Need Help with using complex numbers

This is a discussion on Need Help with using complex numbers within the C++ Programming forums, part of the General Programming Boards category; Using visual C++ how do you use complex numbers in equations?...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    1

    Post Need Help with using complex numbers

    Using visual C++ how do you use complex numbers in equations?

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    I'd be glad to help...I'll just need a better description of 'complex numbers'

    -P

  3. #3
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    There is a STL templated complex number class:

    For example:
    Code:
    #include <complex>
    
    typedef std::complex<double> complex;
    
    int main()
    {
        complex c(2.9, 3.5), d(3.54, 3.5), e; // constructor: complex(real, imaginary)
        e = c + d;
        // etc.
    }
    The normal arithmetic operators are defined for it as well as == and !=.

    The functions defined for it are:

    complex.real()
    complex.imag()

    conj(complex)
    abs(complex)
    arg(complex)
    norm(complex)
    polar(complex)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing unique numbers to an array
    By yardy in forum C Programming
    Replies: 6
    Last Post: 12-27-2006, 08:15 PM
  2. Adding Line numbers in Word
    By Mister C in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 06-24-2004, 08:45 PM
  3. the definition of a mathematical "average" or "mean"
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 12-03-2002, 10:15 AM
  4. Line Numbers in VI and/or Visual C++ :: C++
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 02-10-2002, 09:54 PM
  5. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 05:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21