當前位置: 首頁>>代碼示例>>C#>>正文


C# Complex.IsReal方法代碼示例

本文整理匯總了C#中System.Complex.IsReal方法的典型用法代碼示例。如果您正苦於以下問題:C# Complex.IsReal方法的具體用法?C# Complex.IsReal怎麽用?C# Complex.IsReal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Complex的用法示例。


在下文中一共展示了Complex.IsReal方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Modulus

 public static Complex Modulus(this Complex num1, Complex num2)
 {
     if (!num1.IsReal())
         ErrorLog.Add(new ErrorMessage("Imaginary part ignored for first parameter"));
     if (!num2.IsReal())
         ErrorLog.Add(new ErrorMessage("Imaginary part ignored for second parameter"));
     return new Complex(num1.Real % num2.Real, 0);
 }
開發者ID:Amichai,項目名稱:PhysicsPad,代碼行數:8,代碼來源:ComplexExtensions.cs

示例2: ArcSin

        public static Complex ArcSin(Complex value)
        {
            if (value.IsReal()) return Math.Asin(value.Real);

            if (value.IsImaginary() || value.Imaginary == 0d && value.Real < 0)
            {
                return -ArcSin(-value);
            }

            return -Complex.ImaginaryOne * Sqrt(Ln((1 - value.Square())) + (Complex.ImaginaryOne * value));
        }
開發者ID:zdimension,項目名稱:IMPression,代碼行數:11,代碼來源:Functions.cs

示例3: ArcCos

        public static Complex ArcCos(Complex value)
        {
            if (value.IsReal()) return Math.Acos(value.Real);

            /*if (value.Imaginary < 0 || value.Imaginary == 0d && value.Real > 0)
			{
				return Constant.Pi - Acos(-value);
			}
			*/
            return -Complex.ImaginaryOne * Ln(value + Complex.ImaginaryOne * Sqrt(1 - value.Square()));

            //return (Constant.Pi / 2.0) + Constant.I * Ln(Constant.I * value + Sqrt(1 - value.Square()));
        }
開發者ID:zdimension,項目名稱:IMPression,代碼行數:13,代碼來源:Functions.cs

示例4: Round

 public static Complex Round(Complex a)
 {
     if (!a.IsReal()) return new Complex(Round(a.Real), Round(a.Imaginary), a.ViewMode, a.IsIndeterminate());
     return Abs(Frac(a)) < 0.5 ? Floor(a) : Ceil(a);
 }
開發者ID:zdimension,項目名稱:IMPression,代碼行數:5,代碼來源:Functions.cs

示例5: Abs

 public static Complex Abs(Complex value)
 {
     return value.IsReal() ? Quad.Abs(value.Real) : value.Module;
 }
開發者ID:zdimension,項目名稱:IMPression,代碼行數:4,代碼來源:Functions.cs

示例6: PolyLog

 public static Complex PolyLog(Complex v, Complex p, Complex z)
 {
     if (z.Module >= 1) return Complex.Indeterminate;
     if ((p.Real % 1) != 0) return Complex.Indeterminate;
     if (p <= 0) return Complex.Indeterminate;
     return p.IsReal() ? SumInf(k => (Pow(-1, k + p) * StirlingS1(k, p) * Pow(z, k)) / (Pow(k, v) * Fact(k)), 1) : Complex.Indeterminate;
 }
開發者ID:zdimension,項目名稱:IMPression,代碼行數:7,代碼來源:Functions.cs

示例7: ArcTan

        public static Complex ArcTan(Complex value)
        {
            if (value.IsReal()) return Math.Atan(value.Real);

            var iz = new Complex(-value.Imaginary, value.Real);
            return new Complex(0, 0.5) * (Ln(1 - iz) - Ln(1 + iz));
        }
開發者ID:zdimension,項目名稱:IMPression,代碼行數:7,代碼來源:Functions.cs

示例8: UnitStep

 public static Complex UnitStep(Complex x)
 {
     if (!x.IsReal()) return Complex.Indeterminate;
     if (x >= 0.0) return 1.0;
     if (x < 0.0) return 0.0;
     return Complex.Indeterminate;
 }
開發者ID:zdimension,項目名稱:IMPression,代碼行數:7,代碼來源:Functions.cs

示例9: PrimePi

 public static Complex PrimePi(Complex x)
 {
     if (!x.IsReal()) return Complex.Indeterminate;
     if (x.Real < 0) return 0.0;
     return Sum(k => UnitStep(x - Prime(k)), 1, Floor(x));
 }
開發者ID:zdimension,項目名稱:IMPression,代碼行數:6,代碼來源:Functions.cs


注:本文中的System.Complex.IsReal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。