/** * Compute the * <a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top"> * square root</a> of 1 - <code>z</code><sup>2</sup> for the given complex * argument. * <p> * Computes the result directly as * <code>sqrt(DoubleComplexImpl.ONE.subtract(z.multiply(z)))</code>. * <p> * Returns {@link ComplexNum#NaN} if either real or imaginary part of the * input argument is <code>NaN</code>. * <p> * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * * @param z the value * @return the square root of 1 - <code>z</code><sup>2</sup> * @throws NullPointerException if <code>z</code> is null */ public static ComplexNum sqrt1z(final ComplexNum z) { return sqrt(ComplexNum.ONE.subtract(z.multiply(z))); }
/** * Compute the * <a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top"> * square root</a> of 1 - <code>z</code><sup>2</sup> for the given complex * argument. * <p> * Computes the result directly as * <code>sqrt(DoubleComplexImpl.ONE.subtract(z.multiply(z)))</code>. * <p> * Returns {@link ComplexNum#NaN} if either real or imaginary part of the * input argument is <code>NaN</code>. * <p> * Infinite values in real or imaginary parts of the input may result in * infinite or NaN values returned in parts of the result. * * @param z the value * @return the square root of 1 - <code>z</code><sup>2</sup> * @throws NullPointerException if <code>z</code> is null */ public static ComplexNum sqrt1z(final ComplexNum z) { return sqrt(ComplexNum.ONE.subtract(z.multiply(z))); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseTangent.html" TARGET="_top"> * inverse tangent</a> for the given complex argument. * <p> * Implements the formula: <pre> * <code> atan(z) = (i/2) log((i + z)/(i - z)) </code></pre> * <p> * Returns {@link ComplexNum#NaN} if either real or imaginary part of the * input argument is <code>NaN</code> or infinite. * * @param z the value whose inverse tangent is to be returned * @return the inverse tangent of <code>z</code> * @throws NullPointerException if <code>z</code> is null */ public static ComplexNum atan(final ComplexNum z) { if (z.isNaN()) { return ComplexNum.NaN; } return ComplexNum.I.multiply( log(ComplexNum.I.add(z).divide(ComplexNum.I.subtract(z)))) .divide(ComplexNum.valueOf(2.0, 0.0)); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseTangent.html" TARGET="_top"> * inverse tangent</a> for the given complex argument. * <p> * Implements the formula: <pre> * <code> atan(z) = (i/2) log((i + z)/(i - z)) </code></pre> * <p> * Returns {@link ComplexNum#NaN} if either real or imaginary part of the * input argument is <code>NaN</code> or infinite. * * @param z the value whose inverse tangent is to be returned * @return the inverse tangent of <code>z</code> * @throws NullPointerException if <code>z</code> is null */ public static ComplexNum atan(final ComplexNum z) { if (z.isNaN()) { return ComplexNum.NaN; } return ComplexNum.I.multiply( log(ComplexNum.I.add(z).divide(ComplexNum.I.subtract(z)))) .divide(ComplexNum.valueOf(2.0, 0.0)); }