本文整理汇总了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);
}
示例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));
}
示例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()));
}
示例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);
}
示例5: Abs
public static Complex Abs(Complex value)
{
return value.IsReal() ? Quad.Abs(value.Real) : value.Module;
}
示例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;
}
示例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));
}
示例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;
}
示例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));
}