Divides a complex number by a real number.
Performs division with complex numbers.
Overload List
Example
The following example demonstrates the use of the
Complex structure in order to perform some complex arithmetic operations.
| Visual Basic | Copy Code |
|---|
Imports System
Imports Bluebit.MatrixLibrary
Class Test
Public Shared Sub Main()
'Decraring Complex numbers
Dim c1 As Complex = New Complex(3, 4), c2 As Complex = New Complex(2, 3)
Console.WriteLine(String.Format("c1 = {0}", c1))
Console.WriteLine(String.Format("c2 = {0}", c2))
Dim c3, c4, c5, c6, c7, c8, c9 As Complex
Dim d1 As Double
'Addition
c3 = Complex.Add(c1, c2)
Console.WriteLine(String.Format("c3 = c1+c2 = {0}", c3))
'Subtraction
c4 = Complex.Subtract(c1, c2)
Console.WriteLine(String.Format("c4 = c1-c2 = {0}", c4))
'Multiplication
c5 = Complex.Multiply(c1, c2)
Console.WriteLine(String.Format("c5 = c1*c2 = {0}", c5))
'Division
c6 = Complex.Divide(c1, c2)
Console.WriteLine(String.Format("c6 = c1/c2 = {0}", c6.ToString("G4")))
'Square root of Complex
c7 = c1.Sqrt
Console.WriteLine(String.Format("c7 = Sqrt(c1) = {0}", c7.ToString("G4")))
'Conjugate
c8 = c1.Conjugate
Console.WriteLine(String.Format("c8 = Conj(c1) = {0}", c8))
'Reciprocal
c9 = c1.Reciprocal
Console.WriteLine(String.Format("c9 = 1/c1 = {0}", c9.ToString("G4")))
'Absolute value
d1 = c1.Abs
Console.WriteLine(String.Format("d1 = c1.Abs = {0}", d1))
Console.Read()
End Sub
End Class
|
| C# | Copy Code |
|---|
using System;
using Bluebit.MatrixLibrary;
class Test
{
static void Main(string[] args)
{
//Decraring Complex numbers
Complex c1 = new Complex(3, 4), c2 = new Complex(2, 3);
Console.WriteLine(String.Format("c1 = {0}", c1));
Console.WriteLine(String.Format("c2 = {0}", c2));
Complex c3, c4, c5, c6, c7, c8, c9;
double d1;
//Addition
c3 = c1 + c2;
//c3 = Complex.Add(c1, c2);
Console.WriteLine(String.Format("c3 = c1+c2 = {0}", c3));
//Subtraction
c4 = c1 - c2;
//c4 = Complex.Subtract(c1, c2);
Console.WriteLine(String.Format("c4 = c1-c2 = {0}", c4));
//Multiplication
c5 = c1 * c2;
//c5 = Complex.Multiply(c1, c2);
Console.WriteLine(String.Format("c5 = c1*c2 = {0}", c5));
//Division
c6 = c1 / c2;
//c6 = Complex.Divide(c1, c2);
Console.WriteLine(String.Format("c6 = c1/c2 = {0}", c6.ToString("G4")));
//Square root of Complex
c7 = c1.Sqrt();
Console.WriteLine(String.Format("c7 = Sqrt(c1) = {0}", c7.ToString("G4")));
//Conjugate
c8 = c1.Conjugate();
Console.WriteLine(String.Format("c8 = Conj(c1) = {0}", c8));
//Reciprocal
c9 = c1.Reciprocal();
Console.WriteLine(String.Format("c9 = 1/c1 = {0}", c9.ToString("G4")));
//Absolute value
d1 = c1.Abs();
Console.WriteLine(String.Format("d1 = c1.Abs = {0}", d1));
Console.Read();
}
}
|
| C++ | Copy Code |
|---|
#include "stdafx.h"
using namespace System;
using namespace Bluebit::MatrixLibrary;
int main(array<System::String ^> ^args)
{
//Decraring Complex numbers
Complex c1 = Complex(3.0, 4.0), c2 = Complex(2.0, 3.0);
Console::WriteLine(String::Format("c1 = {0}", c1.ToString()));
Console::WriteLine(String::Format("c2 = {0}", c2.ToString()));
Complex c3, c4, c5, c6, c7, c8, c9;
double d1;
//Addition
c3 = c1 + c2;
//c3 = Complex::Add(c1, c2);
Console::WriteLine(String::Format("c3 = c1+c2 = {0}", c3.ToString() ));
//Subtraction
c4 = c1 - c2;
//c4 = Complex.Subtract(c1, c2);
Console::WriteLine(String::Format("c4 = c1-c2 = {0}", c4.ToString() ));
//Multiplication
c5 = c1 * c2;
//c5 = Complex.Multiply(c1, c2);
Console::WriteLine(String::Format("c5 = c1*c2 = {0}", c5.ToString() ));
//Division
c6 = c1 / c2;
//c6 = Complex.Divide(c1, c2);
Console::WriteLine(String::Format("c6 = c1/c2 = {0}", c6.ToString("G4") ));
//Square root of Complex
c7 = c1.Sqrt();
Console::WriteLine(String::Format("c7 = Sqrt(c1) = {0}", c7.ToString("G4")));
//Conjugate
c8 = c1.Conjugate();
Console::WriteLine(String::Format("c8 = Conj(c1) = {0}", c8.ToString() ));
//Reciprocal
c9 = c1.Reciprocal();
Console::WriteLine(String::Format("c9 = 1/c1 = {0}", c9.ToString("G4")));
//Absolute value
d1 = c1.Abs();
Console::WriteLine(String::Format("d1 = c1.Abs = {0}", d1 ));
Console::Read();
return 0;
}
|
Requirements
Platforms: Windows 7, Windows Vista, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows 2000
See Also