Click here to Skip to main content
Click here to Skip to main content

Class to handle complex numbers natively

, 6 Dec 2006
Rate this:
Please Sign up or sign in to vote.
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

Share

About the Author

Dan2178
Web Developer
United States United States
No Biography provided

Comments and Discussions

 
NewsABS same as MAG PinmemberEdward Giles3-Sep-11 20:07 

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.

| Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 6 Dec 2006
Article Copyright 2006 by Dan2178
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid