Results 1 to 3 of 3

Thread: Sqrt of -1

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    38

    Thumbs up Sqrt of -1

    Is this possible in VB?
    I know how to work with complex numbers (adding, subtraction, division, multiply) in borland c++, but in vb?

  2. #2
    jim mcnamara
    Guest
    You have to represent complex numbers with a UDT like
    Code:
    Type Complex
            r as Single
            imag as Single
    End Type
    Dim Im as Complex
    Then you have to do all the math in functions that you write yourself.

    Code:
    Function ComplexAdd(a as Complex,b as Complex) as Complex
         Dim tmp as Complex
         tmp.r = a.r + b.r
         tmp.imag = a.imag + b.imag
         ComplexAdd = tmp
    End Function

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    38
    thnx men, it look alot like C++. I thought it was more difficult then that!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width