Пример #1
0
        /**
         * Calculates the cosine (cosinus) of {@link BigComplex} x in the complex domain.
         *
         * @param x the {@link BigComplex} to calculate the cosine for
         * @param mathContext the {@link MathContext} used for the result
         * @return the calculated cosine {@link BigComplex} with the precision specified in the <code>mathContext</code>
         */
        public static BigComplex cos(this BigComplex x, MathContext mathContext)
        {
            MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode());

            return(BigComplex.valueOf(
                       BigDecimalMath.cos(x.re, mc).multiply(BigDecimalMath.cosh(x.im, mc), mc).round(mathContext),
                       BigDecimalMath.sin(x.re, mc).multiply(BigDecimalMath.sinh(x.im, mc), mc).negate().round(mathContext)));
        }