public static ComplexNumber add(double x, ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(new ComplexNumber(z.Real + x, z.Imaginary));
 }
 public static double arg(ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(Math.Atan2(z.Imaginary, z.Real));
 }
 public static ComplexNumber subtract(ComplexNumber z, double x)
 {
     ArgChecker.notNull(z, "z");
     return(new ComplexNumber(z.Real - x, z.Imaginary));
 }
 public static ComplexNumber subtract(double x, ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(new ComplexNumber(x - z.Real, -z.Imaginary));
 }
Beispiel #5
0
        public static ComplexNumber tan(ComplexNumber z)
        {
            ComplexNumber b = ComplexMathUtils.exp(ComplexMathUtils.multiply(ComplexMathUtils.multiply(I, 2), z));

            return(ComplexMathUtils.divide(ComplexMathUtils.subtract(b, 1), ComplexMathUtils.multiply(I, ComplexMathUtils.add(b, 1))));
        }
 public static ComplexNumber subtract(ComplexNumber z1, ComplexNumber z2)
 {
     ArgChecker.notNull(z1, "z1");
     ArgChecker.notNull(z2, "z2");
     return(new ComplexNumber(z1.Real - z2.Real, z1.Imaginary - z2.Imaginary));
 }
        public static ComplexNumber multiply(double x, params ComplexNumber[] z)
        {
            ComplexNumber product = multiply(z);

            return(multiply(x, product));
        }
Beispiel #8
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: private void assertComplexEquals(final ComplexNumber z, final double x)
        private void assertComplexEquals(ComplexNumber z, double x)
        {
            assertEquals(z.Imaginary, 0, EPS);
            assertEquals(z.Real, x, EPS);
        }
 /// <summary>
 /// Returns the principal value of log, with z the principal argument of z defined to lie in the interval (-pi, pi]. </summary>
 /// <param name="z"> ComplexNumber </param>
 /// <returns> The log </returns>
 public static ComplexNumber log(ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(new ComplexNumber(Math.Log(Math.hypot(z.Real, z.Imaginary)), Math.Atan2(z.Imaginary, z.Real)));
 }
 public static double mod(ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(Math.hypot(z.Real, z.Imaginary));
 }
Beispiel #11
0
 public static ComplexNumber atanh(ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(ComplexMathUtils.multiply(0.5, ComplexMathUtils.log(ComplexMathUtils.divide(ComplexMathUtils.add(1, z), ComplexMathUtils.subtract(1, z)))));
 }
Beispiel #12
0
 public static ComplexNumber asinh(ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(ComplexMathUtils.log(ComplexMathUtils.add(z, ComplexMathUtils.sqrt(ComplexMathUtils.add(ComplexMathUtils.multiply(z, z), 1)))));
 }
Beispiel #13
0
 public static ComplexNumber asin(ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(ComplexMathUtils.multiply(NEGATIVE_I, ComplexMathUtils.log(ComplexMathUtils.add(ComplexMathUtils.multiply(I, z), ComplexMathUtils.sqrt(ComplexMathUtils.subtract(1, ComplexMathUtils.multiply(z, z)))))));
 }
 public static ComplexNumber conjugate(ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(new ComplexNumber(z.Real, -z.Imaginary));
 }
 public static ComplexNumber multiply(double x, ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(new ComplexNumber(z.Real * x, z.Imaginary * x));
 }
 public static ComplexNumber divide(ComplexNumber z, double x)
 {
     ArgChecker.notNull(z, "z");
     return(new ComplexNumber(z.Real / x, z.Imaginary / x));
 }
 public static ComplexNumber pow(double x, ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(pow(new ComplexNumber(x, 0), z));
 }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: private void assertComplexEquals(final ComplexNumber z1, final ComplexNumber z2)
        private void assertComplexEquals(ComplexNumber z1, ComplexNumber z2)
        {
            assertEquals(z1.Real, z2.Real, EPS);
            assertEquals(z1.Imaginary, z2.Imaginary, EPS);
        }
Beispiel #19
0
 public static ComplexNumber sinh(ComplexNumber z)
 {
     ArgChecker.notNull(z, "z");
     return(new ComplexNumber(Math.Sinh(z.Real) * Math.Cos(z.Imaginary), Math.Cosh(z.Real) * Math.Sin(z.Imaginary)));
 }