本文整理汇总了C#中Complex.Abs方法的典型用法代码示例。如果您正苦于以下问题:C# Complex.Abs方法的具体用法?C# Complex.Abs怎么用?C# Complex.Abs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Complex
的用法示例。
在下文中一共展示了Complex.Abs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public void Run()
{
var a = new Complex(5.0, 6.0);
var b = new Complex(-3.0, 4.0);
Console.WriteLine("a = " + a);
Console.WriteLine("b = " + b);
Console.WriteLine("Re(a) = " + a.Re());
Console.WriteLine("Im(a) = " + a.Im());
Console.WriteLine("b + a = " + b.Plus(a));
Console.WriteLine("a - b = " + a.Minus(b));
Console.WriteLine("a * b = " + a.Times(b));
Console.WriteLine("b * a = " + b.Times(a));
Console.WriteLine("a / b = " + a.Divides(b));
Console.WriteLine("(a / b) * b = " + a.Divides(b).Times(b));
Console.WriteLine("conj(a) = " + a.Conjugate());
Console.WriteLine("|a| = " + a.Abs());
Console.WriteLine("tan(a) = " + a.Tan());
Console.ReadLine();
}
示例2: test
// sample client for testing
public static void test()
{
Complex a = new Complex(5.0, 6.0);
Complex b = new Complex(-3.0, 4.0);
System.Diagnostics.Debug.WriteLine("a = " + a);
System.Diagnostics.Debug.WriteLine("b = " + b);
System.Diagnostics.Debug.WriteLine("Re(a) = " + a.Re);
System.Diagnostics.Debug.WriteLine("Im(a) = " + a.Im);
System.Diagnostics.Debug.WriteLine("b + a = " + b.Plus(a));
System.Diagnostics.Debug.WriteLine("a - b = " + a.Minus(b));
System.Diagnostics.Debug.WriteLine("a * b = " + a.Times(b));
System.Diagnostics.Debug.WriteLine("b * a = " + b.Times(a));
System.Diagnostics.Debug.WriteLine("a / b = " + a.Divides(b));
System.Diagnostics.Debug.WriteLine("(a / b) * b = " + a.Divides(b).Times(b));
System.Diagnostics.Debug.WriteLine("conj(a) = " + a.Conjugate());
System.Diagnostics.Debug.WriteLine("|a| = " + a.Abs());
System.Diagnostics.Debug.WriteLine("tan(a) = " + a.Tan());
}
示例3: test
public static int test(Complex z, Complex c)
{
for(int q = 0 ; q < 16 ; q++) {
z = z * z + c;
if(z.Abs() >= 2.0) return q;
} return 16;
}