/** * Returns of value of this complex number raised to the power of {@code x}. * * @param x exponent to which this {@code Complex} is to be raised. * @return <code>this<sup>x</sup></code>. * @see #pow(Complex) */ public Complex pow(double x) { return this.log().multiply(x).exp(); }
/** * Returns of value of this complex number raised to the power of {@code x}. * Implements the formula: * <pre> * <code> * y<sup>x</sup> = exp(x·log(y)) * </code> * </pre> * where {@code exp} and {@code log} are {@link #exp} and * {@link #log}, respectively. * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN} or infinite, or if {@code y} * equals {@link Complex#ZERO}.</p> * * @param x exponent to which this {@code Complex} is to be raised. * @return <code> this<sup>x</sup></code>. * @throws NullArgumentException if x is {@code null}. * @since 1.2 */ public Complex pow(Complex x) throws NullArgumentException { MathUtils.checkNotNull(x); return this.log().multiply(x).exp(); }
/** * Returns of value of this complex number raised to the power of {@code x}. * * @param x exponent to which this {@code Complex} is to be raised. * @return <code>this<sup>x</sup></code>. * @see #pow(Complex) */ public Complex pow(double x) { return this.log().multiply(x).exp(); }
/** * Returns of value of this complex number raised to the power of {@code x}. * * @param x exponent to which this {@code Complex} is to be raised. * @return <code>this<sup>x</sup></code>. * @see #pow(Complex) */ public Complex pow(double x) { return this.log().multiply(x).exp(); }
/** * Returns of value of this complex number raised to the power of {@code x}. * Implements the formula: * <pre> * <code> * y<sup>x</sup> = exp(x·log(y)) * </code> * </pre> * where {@code exp} and {@code log} are {@link #exp} and * {@link #log}, respectively. * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN} or infinite, or if {@code y} * equals {@link Complex#ZERO}.</p> * * @param x exponent to which this {@code Complex} is to be raised. * @return <code> this<sup>x</sup></code>. * @throws NullArgumentException if x is {@code null}. * @since 1.2 */ public Complex pow(Complex x) throws NullArgumentException { MathUtils.checkNotNull(x); return this.log().multiply(x).exp(); }
/** * Returns of value of this complex number raised to the power of {@code x}. * Implements the formula: * <pre> * <code> * y<sup>x</sup> = exp(x·log(y)) * </code> * </pre> * where {@code exp} and {@code log} are {@link #exp} and * {@link #log}, respectively. * <p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN} or infinite, or if {@code y} * equals {@link Complex#ZERO}.</p> * * @param x exponent to which this {@code Complex} is to be raised. * @return <code> this<sup>x</sup></code>. * @throws NullArgumentException if x is {@code null}. * @since 1.2 */ public Complex pow(Complex x) throws NullArgumentException { MathUtils.checkNotNull(x); return this.log().multiply(x).exp(); }
/** * c = e ^ a Michael Borcherds 2009-03-10 * * @param a * power * @param c * result */ public static void complexExp(GeoVec2D a, GeoVec2D c) { Complex out = new Complex(a.x, a.y); out = out.exp(); c.x = out.getReal(); c.y = out.getImaginary(); c.setMode(Kernel.COORD_COMPLEX); }
public ValueType exp(CalculatedValue g) { if (g.isComplex()) { return setComplexValue(g.getComplex().exp()); } else { return setValue(FastMath.exp(g.real)); } }
private Complex[] characteristic(double[] lambdasquare, double[] t) { // z<--0.5*log(1-2i*lambdasquare%*%t(t)); Complex c = new Complex(0, -2); Complex[] temp = new Complex[lambdasquare.length]; for (int i = 0; i < temp.length; i++) { temp[i] = c.multiply(lambdasquare[i]); } Complex[][] z = this.complex(temp, t); // return(exp(complex(length(t),rowsum(Re(z),rep(1,length(lambdasquare))),rowsum(Im(z),rep(1,length(lambdasquare)))))) double[] real = new double[t.length]; double[] imag = new double[t.length]; for (int j = 0; j < t.length; j++) { for (Complex[] z1 : z) { real[j] += z1[j].getReal(); imag[j] += z1[j].getImaginary(); } } Complex[] result = new Complex[t.length]; for (int i = 0; i < t.length; i++) { result[i] = new Complex(real[i], imag[i]); result[i] = result[i].exp(); } return result; }
/** * c = a ^ b Michael Borcherds 2009-03-10 * * @param a * base * @param b * power * @param c * result */ public static void complexPower(GeoVec2D a, NumberValue b, GeoVec2D c) { if (a.x == 0 && a.y == 0 && b.getDouble() > 0) { c.x = 0; c.y = 0; } else { Complex out = new Complex(a.x, a.y); out = out.log().multiply(b.getDouble()).exp(); c.x = out.getReal(); c.y = out.getImaginary(); } c.setMode(Kernel.COORD_COMPLEX); }
/** * Numerical exponent. * * @param complex argument * @return exponent */ public static Complex exp(Complex complex) { if (complex.isReal()) return new Complex(FastMath.exp(complex.getReal().doubleValue())); return new Complex(new org.apache.commons.math3.complex.Complex(complex.getReal().doubleValue(), complex.getImaginary().doubleValue()).exp()); } }
/** * c = a ^ b Michael Borcherds 2009-03-10 * * @param a * base * @param b * exponent * @param c * result */ public static void complexPower(NumberValue a, GeoVec2D b, GeoVec2D c) { Complex out; if (MyDouble.exactEqual(a.getDouble(), Math.E)) { // special case for e^(i theta) // (more accurate) out = new Complex(b.x, b.y); out = out.exp(); } else { out = new Complex(a.getDouble(), 0); out = out.pow(new Complex(b.x, b.y)); } c.x = out.getReal(); c.y = out.getImaginary(); c.setMode(Kernel.COORD_COMPLEX); }
Complex[] hTemp = this.multiply(t, z); for (int i = 0; i < hTemp.length; i++) { hTemp[i] = hTemp[i].exp();