public static ComplexNumber acosh(ComplexNumber z) { ArgChecker.notNull(z, "z"); return ComplexMathUtils.log( ComplexMathUtils.add( z, ComplexMathUtils.sqrt(ComplexMathUtils.subtract(ComplexMathUtils.multiply(z, z), 1)))); }
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)))); }
/** * arccos - the inverse of cos. * @param z A complex number * @return acos(z) */ public static ComplexNumber acos(ComplexNumber z) { ArgChecker.notNull(z, "z"); return ComplexMathUtils.multiply( NEGATIVE_I, ComplexMathUtils.log( ComplexMathUtils.add( z, ComplexMathUtils.sqrt(ComplexMathUtils.subtract(ComplexMathUtils.multiply(z, z), 1))))); }
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)))))); }
@Test public void testSqrt() { ComplexNumber z1 = new ComplexNumber(3, -2); ComplexNumber z2 = new ComplexNumber(-3, 4); ComplexNumber z3 = new ComplexNumber(-3, -4); ComplexNumber rZ1 = ComplexMathUtils.sqrt(z1); ComplexNumber rZ2 = ComplexMathUtils.sqrt(z2); ComplexNumber rZ3 = ComplexMathUtils.sqrt(z3); assertComplexEquals(ComplexMathUtils.pow(z1, 0.5), rZ1); assertComplexEquals(ComplexMathUtils.pow(z2, 0.5), rZ2); assertComplexEquals(ComplexMathUtils.pow(z3, 0.5), rZ3); assertComplexEquals(z1, ComplexMathUtils.square(rZ1)); assertComplexEquals(z2, ComplexMathUtils.square(rZ2)); assertComplexEquals(z3, ComplexMathUtils.square(rZ3)); }
@Test public void testPower() { assertComplexEquals(ComplexMathUtils.pow(Z1, 0), new ComplexNumber(1, 0)); assertComplexEquals(ComplexMathUtils.pow(X, new ComplexNumber(0, 0)), new ComplexNumber(1, 0)); assertComplexEquals(ComplexMathUtils.sqrt(ComplexMathUtils.pow(Z1, 2)), Z1); assertComplexEquals(ComplexMathUtils.sqrt(ComplexMathUtils.pow(Z2, 2)), Z2); assertComplexEquals(ComplexMathUtils.pow(ComplexMathUtils.pow(Z1, 1. / 3), 3), Z1); assertComplexEquals(ComplexMathUtils.pow(ComplexMathUtils.pow(X, ComplexMathUtils.inverse(Z2)), Z2), new ComplexNumber(X, 0)); assertComplexEquals(ComplexMathUtils.pow(ComplexMathUtils.pow(Z1, ComplexMathUtils.inverse(Z2)), Z2), Z1); }
ComplexMathUtils.sqrt(null); } catch (final IllegalArgumentException e) { assertStackTraceElement(e.getStackTrace());