@Override public IExpr numericEvalDC1(final ComplexNum arg1) { return ComplexUtils.atan(arg1); }
@Override public IExpr e1DblComArg(final IComplexNum arg1) { return ComplexUtils.log((ComplexNum) arg1); }
@Override public IExpr numericEvalDC1(final ComplexNum arg1) { return ComplexUtils.acos(arg1); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseCosine.html" TARGET="_top"> * inverse cosine</a> for the given complex argument. * <p> * Implements the formula: <pre> * <code> acos(z) = -i (log(z + i (sqrt(1 - z<sup>2</sup>))))</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 cosine is to be returned * @return the inverse cosine of <code>z</code> * @throws NullPointerException if <code>z</code> is null */ public static ComplexNum acos(final ComplexNum z) { if (z.isNaN()) { return ComplexNum.NaN; } return ComplexNum.I.negate().multiply(log(z.add( ComplexNum.I.multiply(sqrt1z(z))))); }
/** * Returns of value of <code>y</code> raised to the power of <code>x</code>. * <p> * Implements the formula: <pre> * <code> y<sup>x</sup> = exp(x·log(y))</code></pre> * where <code>exp</code> and <code>log</code> are {@link #exp} and * {@link #log}, respectively. * <p> * Returns {@link ComplexNum#NaN} if either real or imaginary part of the * input argument is <code>NaN</code> or infinite, or if <code>y</code> * equals {@link ComplexNum#ZERO}. * * @param y the base. * @param x the exponent. * @return <code>y</code><sup><code>x</code></sup> * @throws NullPointerException if either x or y is null */ public static ComplexNum pow(final ComplexNum y, final ComplexNum x) { return exp(x.multiply(log(y))); }
/** * 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))); }
@Override public IExpr numericEvalDC1(final ComplexNum arg1) { return ComplexUtils.sin(arg1); }
@Override public IExpr numericEvalDC1(final ComplexNum arg1) { return ComplexUtils.cos(arg1); }
@Override public IExpr numericEvalDC1(final ComplexNum arg1) { return ComplexUtils.cosh(arg1); }
@Override public IExpr numericEvalDC1(final ComplexNum arg1) { return ComplexUtils.asin(arg1); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top"> * inverse sine</a> for the given complex argument. * <p> * Implements the formula: <pre> * <code> asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz)) </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 sine is to be returned. * @return the inverse sine of <code>z</code>. * @throws NullPointerException if <code>z</code> is null */ public static ComplexNum asin(final ComplexNum z) { if (z.isNaN()) { return ComplexNum.NaN; } return ComplexNum.I.negate().multiply(log(sqrt1z(z).add( ComplexNum.I.multiply(z)))); }
/** * Returns of value of <code>y</code> raised to the power of <code>x</code>. * <p> * Implements the formula: <pre> * <code> y<sup>x</sup> = exp(x·log(y))</code></pre> * where <code>exp</code> and <code>log</code> are {@link #exp} and * {@link #log}, respectively. * <p> * Returns {@link ComplexNum#NaN} if either real or imaginary part of the * input argument is <code>NaN</code> or infinite, or if <code>y</code> * equals {@link ComplexNum#ZERO}. * * @param y the base. * @param x the exponent. * @return <code>y</code><sup><code>x</code></sup> * @throws NullPointerException if either x or y is null */ public static ComplexNum pow(final ComplexNum y, final ComplexNum x) { return exp(x.multiply(log(y))); }
/** * 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))); }
@Override public IExpr numericEvalDC1(final ComplexNum arg1) { return ComplexUtils.sin(arg1).inverse(); }
@Override public IExpr numericEvalDC1(final ComplexNum arg1) { return ComplexUtils.cos(arg1).inverse(); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseCosine.html" TARGET="_top"> * inverse cosine</a> for the given complex argument. * <p> * Implements the formula: <pre> * <code> acos(z) = -i (log(z + i (sqrt(1 - z<sup>2</sup>))))</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 cosine is to be returned * @return the inverse cosine of <code>z</code> * @throws NullPointerException if <code>z</code> is null */ public static ComplexNum acos(final ComplexNum z) { if (z.isNaN()) { return ComplexNum.NaN; } return ComplexNum.I.negate().multiply(log(z.add( ComplexNum.I.multiply(sqrt1z(z))))); }
@Override public IExpr e1DblComArg(final IComplexNum arg1) { return ComplexUtils.log((ComplexNum) arg1); }
@Override public IExpr e1DblComArg(final IComplexNum c) { return ComplexUtils.atan((ComplexNum) c); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top"> * inverse sine</a> for the given complex argument. * <p> * Implements the formula: <pre> * <code> asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz)) </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 sine is to be returned. * @return the inverse sine of <code>z</code>. * @throws NullPointerException if <code>z</code> is null */ public static ComplexNum asin(final ComplexNum z) { if (z.isNaN()) { return ComplexNum.NaN; } return ComplexNum.I.negate().multiply(log(sqrt1z(z).add( ComplexNum.I.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)); }