oldc = c[j]; c[j] = newc; newc = oldc.add(newc.multiply(root[i]));
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top"> * inverse sine</a> of this complex number. * Implements the formula: * <p> * {@code asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz))} * </p><p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN} or infinite.</p> * * @return the inverse sine of this complex number. * @since 1.2 */ public Complex asin() { if (isNaN) { return NaN; } return sqrt1z().add(this.multiply(I)).log().multiply(I.negate()); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseCosine.html" TARGET="_top"> * inverse cosine</a> of this complex number. * Implements the formula: * <p> * {@code acos(z) = -i (log(z + i (sqrt(1 - z<sup>2</sup>))))} * </p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN} or infinite. * * @return the inverse cosine of this complex number. * @since 1.2 */ public Complex acos() { if (isNaN) { return NaN; } return this.add(this.sqrt1z().multiply(I)).log().multiply(I.negate()); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseTangent.html" TARGET="_top"> * inverse tangent</a> of this complex number. * Implements the formula: * <p> * {@code atan(z) = (i/2) log((i + z)/(i - z))} * </p><p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN} or infinite.</p> * * @return the inverse tangent of this complex number * @since 1.2 */ public Complex atan() { if (isNaN) { return NaN; } return this.add(I).divide(I.subtract(this)).log() .multiply(I.divide(createComplex(2.0, 0.0))); }
Complex d2v = Complex.ZERO; for (int j = n-1; j >= 0; j--) { d2v = dv.add(z.multiply(d2v)); dv = pv.add(z.multiply(dv)); pv = coefficients[j].add(z.multiply(pv)); final Complex dplus = G.add(deltaSqrt); final Complex dminus = G.subtract(deltaSqrt); final Complex denominator = dplus.abs() > dminus.abs() ? dplus : dminus; z = z.add(new Complex(absoluteAccuracy, absoluteAccuracy)); oldz = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
zbs[degree + i] = new Complex(0, -wo); for(int i = 0; i < p.length; i++) pbs[i] = php[i].add((php[i].pow(2).subtract(Math.pow(wo, 2))).sqrt()); for(int i = 0; i < p.length; i++) pbs[i + p.length] = php[i].subtract((php[i].pow(2).subtract(Math.pow(wo, 2))).sqrt());
/** * @param that * @return */ public Complex add(final Complex that) { return fComplex.add(that); }
public ComplexNum add(final ComplexNum that) { return newInstance(fComplex.add(that.fComplex)); }
public IComplexNum add(final IComplexNum val) { return newInstance(fComplex.add(((ComplexNum) val).fComplex)); }
/** * @param that * @return */ @Override public IExpr plus(final IExpr that) { if (that instanceof ComplexNum) { return newInstance(fComplex.add(((ComplexNum) that).fComplex)); } return super.plus(that); }
public Quadripole cascade(Quadripole q2) { Quadripole q1 = this; Quadripole qr = new Quadripole(); qr.a = q1.a.multiply(q2.a).add(q1.b.multiply(q2.c)); qr.b = q1.a.multiply(q2.b).add(q1.b.multiply(q2.d)); qr.c = q1.c.multiply(q2.a).add(q1.d.multiply(q2.c)); qr.d = q1.c.multiply(q2.b).add(q1.d.multiply(q2.d)); return qr; }
private Complex[][] complex(Complex[] v, double[] t) { Complex[][] complex = new Complex[v.length][t.length]; for (int i = 0; i < v.length; i++) { for (int j = 0; j < t.length; j++) { complex[i][j] = v[i].multiply(t[j]).add(new Complex(1, 0)).log().multiply(-0.5); } } return complex; }
public static Complex solve_quadratic_1(double a, double b, double c) { return (new Complex(-b).add(new Complex(b * b - 4 * a * c, 0)).sqrt()) .divide(2. * a); }
public PiModel toPiModel() { PiModel pi = new PiModel(); // Y2 = (A - 1)/B // Y1 = (D - 1)/B Complex y1 = d.add(-1).divide(b); Complex y2 = a.add(-1).divide(b); pi.r = b.getReal(); pi.x = b.getImaginary(); pi.g1 = y1.getReal(); pi.b1 = y1.getImaginary(); pi.g2 = y2.getReal(); pi.b2 = y2.getImaginary(); return pi; } }
public static void main(String[] args) { Complex c1 = new Complex(4.0, 8.5); Complex c2 = new Complex(8.0, 4.5); Complex result = new Complex(8.0, 4.5); result.add(c1,c2); result.print(); result.subtract(c1,c2); result.print();
private Complex transform(Complex c) { if (c.isInfinite()) return new Complex(-1, 0); // frequency transform c = c.multiply(f); Complex one = new Complex(1, 0); // bilinear low pass transform return (one.add(c)).divide(one.subtract(c)); }
/** * Compute the * <a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top"> * inverse sine</a> of this complex number. * Implements the formula: * <p> * {@code asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz))} * </p><p> * Returns {@link Complex#NaN} if either real or imaginary part of the * input argument is {@code NaN} or infinite.</p> * * @return the inverse sine of this complex number. * @since 1.2 */ public Complex asin() { if (notDefined) { return NaN; } return sqrt1z().add(this.multiply(I)).log().multiply(I.negate()); }
public StateVariable toSv1(StateVariable sv2) { Complex s2 = new Complex(-sv2.p, -sv2.q); // s2=p2+jq2 Complex u2 = ComplexUtils.polar2Complex(sv2.u, Math.toRadians(sv2.theta)); Complex v2 = u2.divide(SQUARE_3); // v2=u2/sqrt(3) Complex i2 = s2.divide(v2.multiply(3)).conjugate(); // i2=conj(s2/(3*v2)) Complex v1p = v2.add(z.multiply(i2)); // v1'=v2+z*i2 Complex i1p = i2.negate().add(y.multiply(v1p)); // i1'=-i2+v1'*y Complex i1 = i1p.multiply(ratio); // i1=i1p*ration Complex v1 = v1p.divide(ratio); // v1=v1p/ration Complex s1 = v1.multiply(3).multiply(i1.conjugate()); // s1=3*v1*conj(i1) Complex u1 = v1.multiply(SQUARE_3); return new StateVariable(-s1.getReal(), -s1.getImaginary(), u1.abs(), Math.toDegrees(u1.getArgument())); }
private Complex transform(Complex c) { if (c.isInfinite()) return new Complex(1, 0); // frequency transform c = c.multiply(f); // bilinear high pass transform return new Complex(-1).multiply((new Complex(1)).add(c)).divide( (new Complex(1)).subtract(c)); }