本文整理汇总了C#中Microsoft.Scripting.Math.Complex64类的典型用法代码示例。如果您正苦于以下问题:C# Complex64类的具体用法?C# Complex64怎么用?C# Complex64使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Complex64类属于Microsoft.Scripting.Math命名空间,在下文中一共展示了Complex64类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComplexConstant
private static Expression ComplexConstant(Complex64 value) {
if (value.Real != 0.0) {
if (value.Imag != 0.0) {
return Expression.Call(
typeof(Complex64).GetMethod("Make"),
Expression.Constant(value.Real),
Expression.Constant(value.Imag)
);
} else {
return Expression.Call(
typeof(Complex64).GetMethod("MakeReal"),
Expression.Constant(value.Real)
);
}
} else {
return Expression.Call(
typeof(Complex64).GetMethod("MakeImaginary"),
Expression.Constant(value.Imag)
);
}
}
示例2: Pow
public static Complex64 Pow(Complex64 baseNumber, Complex64 index)
{
if (baseNumber == 0)
{
// this is really non-sensical, but the behavior is defined in the spec, so try follow it at least.
if (index == 0)
{
return 1;
}
return 0;
}
return Exp(index * Log(baseNumber));
}
示例3: Plus
public static Complex64 Plus(Complex64 x) {
return +x;
}
示例4: Divide
public static Complex64 Divide(Complex64 x, Complex64 y) {
return x / y;
}
示例5: Subtract
public static Complex64 Subtract(Complex64 x, Complex64 y) {
return x - y;
}
示例6: Pow
public static Complex64 Pow(this Complex64 self, Complex64 power) {
return self.Power(power);
}
示例7: Atan
public static Complex64 Atan(Complex64 z)
{
return i/2 * Log((i + z)/(i - z));
}
示例8: Cos
public static Complex64 Cos(Complex64 z)
{
Complex64 z1 = Exp(new Complex64(-z.imag, z.real));
Complex64 z2 = Exp(new Complex64(z.imag, -z.real));
return new Complex64(0.5 * (z1.real + z2.real), 0.5 * (z1.imag + z2.imag));
}
示例9: Mod
public static Complex64 Mod(Complex64 x, Complex64 y) {
return x % y;
}
示例10: GetAngle
private static double GetAngle(Complex64 num) {
if (IsNaN(num)) {
return double.NaN;
}
if (double.IsPositiveInfinity(num.Real)) {
if (double.IsPositiveInfinity(num.Imag)) {
return Math.PI * 0.25;
} else if (double.IsNegativeInfinity(num.Imag)) {
return Math.PI * -0.25;
} else {
return 0.0;
}
}
if (double.IsNegativeInfinity(num.Real)) {
if (double.IsPositiveInfinity(num.Imag)) {
return Math.PI * 0.75;
} else if (double.IsNegativeInfinity(num.Imag)) {
return Math.PI * -0.75;
} else {
return DoubleOps.Sign(num.Imag) * Math.PI;
}
}
if (num.Real == 0.0) {
if (num.Imag != 0.0) {
return Math.PI * 0.5 * Math.Sign(num.Imag);
} else {
return (DoubleOps.IsPositiveZero(num.Real) ? 0.0 : Math.PI) * DoubleOps.Sign(GetImag(num));
}
}
return Math.Atan2(num.Imag, num.Real);
}
示例11: GetImag
private static double GetImag(Complex64 num) {
return num.Imag;
}
示例12: IsNaN
private static bool IsNaN(Complex64 num) {
return double.IsNaN(num.Real) || double.IsNaN(num.Imag);
}
示例13: IsInfinity
private static bool IsInfinity(Complex64 num) {
return double.IsInfinity(num.Real) || double.IsInfinity(num.Imag);
}
示例14: Acos
public static Complex64 Acos(Complex64 z)
{
return -i * Log(z + i * Sqrt(1 - Pow(z, 2)));
}
示例15: Sinh
public static Complex64 Sinh(Complex64 z)
{
Complex64 z1 = Exp(z);
Complex64 z2 = Exp(new Complex64(-z.real, -z.imag));
return new Complex64(0.5 * (z1.real - z2.real), 0.5 * (z1.imag - z2.imag));
}