Divide and multiply Complex values in CSharp

Description

The following code shows how to divide and multiply Complex values.

Example


  /*w  w  w. j  ava 2s.  co m*/
  
  
  


using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex c1 = new Complex(Double.MaxValue / 2, Double.MaxValue /2);

      Complex c2 = c1 / Complex.Zero;
      Console.WriteLine(c2.ToString());
      c2 = c2 * new Complex(1.5, 1.5);
      Console.WriteLine(c2.ToString());
      Console.WriteLine();

      Complex c3 = c1 * new Complex(2.5, 3.5);
      Console.WriteLine(c3.ToString());
      c3 = c3 + new Complex(Double.MinValue / 2, Double.MaxValue / 2); 
      Console.WriteLine(c3);
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var