12,503,964 members (58,093 online)
Article
alternative version

11.3K views
19 bookmarked
Posted

# Complex class - Working with complex numbers, improved version

, 30 Oct 2007 CPOL
 Rate this:
This is a new ComplexMath class. The new version supports much more functions and it is much better.

## 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("Z1 - Z2 = " & ComplexMath.OperatorSub(z1, z2).ToString)
.Add("Z1 * Z2 = " & ComplexMath.OperatorMul(z1, z2).ToString)
.Add("Z1 / Z2 = " & ComplexMath.OperatorDiv(z1, z2).ToString)

.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("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("COS (z1) = " & ComplexMath.FunctionCos(z1).ToString)
.Add("SIN (z1) = " & ComplexMath.FunctionSin(z1).ToString)
.Add("TAN (z1) = " & ComplexMath.FunctionTan(z1).ToString)

.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("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("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)```

## Share

 Croatia
No Biography provided