Click here to Skip to main content
Licence 
First Posted 6 Dec 2006
Views 14,918
Bookmarked 12 times

Class to handle complex numbers natively

By | 6 Dec 2006 | Article
Over 100 methods, operators, and overloads.

Introduction

This is a different kind of complex number class for VB.NET than most of the ones I have seen. It is written so that the functions and operators can perform calculations natively by the calling class or method. It is indended to be highly extensible and easy to use.

For example, the arcSin function looks like this:

Public Function arcSin(ByVal z As Complex) As Complex 
     Return -i * Ln((i * z) + Sqrt(1 - z ^ 2)) 
End Function

..and the inverse hyperbolic cosecant looks like this:

Public Function arcCsch(ByVal z As Complex) As Complex
     Return Ln(Sqrt(1 + (1 / (z ^ 2))) + 1 / z)
End Function

These are the mathematical equations for complex numbers, and they will work for complex or real numbers. All 24 trigonometric and hyperbolic functions and their inverses are included in the source code.

Also included are operator and function overloads so that equations such as z+2 (mixing complex and real numbers (in this case doubles or integers)) is valid and allowed. Also perfectly valid are equations such as arcSin(2), where '2' is a real (Double) argument but the result is complex because there are no real number solutions for it.

Included is a class which contains the declarations, constructors, and operators, and a module which has all of the math code in it, and finally a Form class which provides some examples on how to declare and use the methods.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Dan2178

Web Developer

United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
NewsABS same as MAG PinmemberEdward Giles20:07 3 Sep '11  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 6 Dec 2006
Article Copyright 2006 by Dan2178
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid