Click here to Skip to main content
Licence CPOL
First Posted 30 Oct 2007
Views 9,183
Downloads 83
Bookmarked 19 times

Complex class - Working with complex numbers, improved version

By | 30 Oct 2007 | Article
This is a new ComplexMath class. The new version supports much more functions and it is much better.

Screenshot - net_complexmath.jpg

Introduction

This is a new ComplexMath class. The new version supports much more functions and is much better. It has support for trigonometric functions, inverse trigonometric functions, hyperbolic functions, inverse hyperbolic functions, log, exp, ln functions, and more.

Example usage

Here is a list of all the available functions. You can see how easy it is to use. Just like the Math class.

Dim z1 As Complex, z2 As Complex

z1 = ComplexMath.CreateComplex(1, 2)
z2 = ComplexMath.CreateComplex(3, 7)

.
.
.


.Add("Values:")
.Add("Z1 = " & z1.ToString)
.Add("Z2 = " & z2.ToString)

.Add("")
.Add("Operations:")
.Add("Z1 + Z2 = " & ComplexMath.OperatorAdd(z1, z2).ToString)
.Add("Z1 - Z2 = " & ComplexMath.OperatorSub(z1, z2).ToString)
.Add("Z1 * Z2 = " & ComplexMath.OperatorMul(z1, z2).ToString)
.Add("Z1 / Z2 = " & ComplexMath.OperatorDiv(z1, z2).ToString)

.Add("")
.Add("Functions 1:")

.Add("EXP (z1) = " & ComplexMath.FunctionExp(z1).ToString)
.Add("LN (z1) = " & ComplexMath.FunctionLn(z1).ToString)
.Add("LOG (z1 , 10) = " & ComplexMath.FunctionLog(z1, 10).ToString)
.Add("POW (z1 , 2) = " & ComplexMath.FunctionPowN(z1, 2).ToString)
.Add("POW (z1 , z2) = " & ComplexMath.FunctionPowZ(z1, z2).ToString)
.Add("SQR (z1) = " & ComplexMath.FunctionSqr(z1).ToString)

.Add("")
.Add("CONJUGATE (z1) = " & ComplexMath.FunctionConjugate(z1).ToString)
.Add("INVERT (z1) = " & ComplexMath.FunctionInverse(z1).ToString)
.Add("ANGLE (z1) = " & ComplexMath.PropertyAngle(z1).ToString)
.Add("ABS (z1) = " & ComplexMath.PropertyAbs(z1).ToString)

.Add("")
.Add("Functions 2:")

.Add("COS (z1) = " & ComplexMath.FunctionCos(z1).ToString)
.Add("SIN (z1) = " & ComplexMath.FunctionSin(z1).ToString)
.Add("TAN (z1) = " & ComplexMath.FunctionTan(z1).ToString)
.Add("COT(z1) = " & ComplexMath.FunctionCot(z1).ToString)

.Add("")
.Add("COSH (z1) = " & ComplexMath.FunctionCosh(z1).ToString)
.Add("SINH (z1) = " & ComplexMath.FunctionSinh(z1).ToString)
.Add("TANH (z1) = " & ComplexMath.FunctionTanh(z1).ToString)
.Add("COZH (z1) = " & ComplexMath.FunctionCoth(z1).ToString)

.Add("")
.Add("ACOS (z1) = " & ComplexMath.FunctionAcos(z1).ToString)
.Add("ASIN (z1) = " & ComplexMath.FunctionAsin(z1).ToString)
.Add("ATAN (z1) = " & ComplexMath.FunctionAtan(z1).ToString)
.Add("ACOT (z1) = " & ComplexMath.FunctionAcot(z1).ToString)

.Add("")
.Add("ACOSH (z1) = " & ComplexMath.FunctionAcosh(z1).ToString)
.Add("ASINH (z1) = " & ComplexMath.FunctionAsinh(z1).ToString)
.Add("ATANH (z1) = " & ComplexMath.FunctionAtanh(z1).ToString)
.Add("ACOTH (z1) = " & ComplexMath.FunctionAcoth(z1).ToString)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ivan0001



Croatia Croatia

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
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 30 Oct 2007
Article Copyright 2007 by Ivan0001
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid