日期:2014-05-17 浏览次数:20853 次
public class Complex
{
private double realPart, imaginaryPart;
public double RealPart
{ get { return realPart; } set { } }
public double ImaginaryPart
{ get { return imaginaryPart; } set { } }
public Complex(double realPart, double imaginaryPart)
//构造复数函数
{
this.realPart = realPart; this.imaginaryPart = imaginaryPart;
}
//复数取模值//
public static Double Modulus(Complex z)
{
double modular = new double();
modular=Math.Sqrt(z.realPart*z.realPart+z.imaginaryPart*z.imaginaryPart);
return modular;
}
public static Complex Conjugate(Complex z)
//复数的共轭
{
return new Complex(z.realPart, -z.imaginaryPart);
}
//复数的加减乘除//
private static Complex Add( Complex z1, Complex z2)
{
return new Complex(z1.realPart+z2.realPart,z1.imaginaryPart+z2.imaginaryPart);
}
private static Complex Subtract(Complex z1, Complex z2)