/** * Calculates the natural exponent of {@link BigComplex} x (e<sup>x</sup>) in the complex domain. * * <p>See: <a href="https://en.wikipedia.org/wiki/Exponential_function#Complex_plane">Wikipedia: Exponent (Complex plane)</a></p> * * @param x the {@link BigComplex} to calculate the exponent for * @param mathContext the {@link MathContext} used for the result * @return the calculated exponent {@link BigComplex} with the precision specified in the <code>mathContext</code> */ public static BigComplex exp(this BigComplex x, MathContext mathContext) { MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); BigDecimal expRe = BigDecimalMath.exp(x.re, mc); return(BigComplex.valueOf( expRe.multiply(BigDecimalMath.cos(x.im, mc), mc).round(mathContext), expRe.multiply(BigDecimalMath.sin(x.im, mc), mc)).round(mathContext)); }