/** * Performs a division of two complex numbers. * * @param xr real part of the first number * @param xi imaginary part of the first number * @param yr real part of the second number * @param yi imaginary part of the second number * @return result of the complex division */ private Complex cdiv(final double xr, final double xi, final double yr, final double yi) { return new Complex(xr, xi).divide(new Complex(yr, yi)); }
/** * 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 complexFs2 = new Complex(fs2); for(int i = 0; i < z.length; i++){ zz[i] = (complexFs2.add(z[i])).divide(complexFs2.subtract(z[i])); pz[i] = (complexFs2.add(p[i])).divide(complexFs2.subtract(p[i])); for (Complex aP : p) temp2 = temp2.multiply(complexFs2.subtract(aP)); kz = (k * (temp.divide(temp2)).getReal()); return new ArrayList<Object>(Arrays.asList(zz, pzRearranged, kz));
php[i] = numerator.divide(p[i]);
/** * @param that * @return */ public Complex divide(final Complex that) { return fComplex.divide(that); }
public ComplexNum divide(final ComplexNum that) throws ArithmeticException { return newInstance(fComplex.divide(that.fComplex)); }
/** * Performs a division of two complex numbers. * * @param xr real part of the first number * @param xi imaginary part of the first number * @param yr real part of the second number * @param yi imaginary part of the second number * @return result of the complex division */ private Complex cdiv(final double xr, final double xi, final double yr, final double yi) { return new Complex(xr, xi).divide(new Complex(yr, yi)); }
/** * Performs a division of two complex numbers. * * @param xr real part of the first number * @param xi imaginary part of the first number * @param yr real part of the second number * @param yi imaginary part of the second number * @return result of the complex division */ private Complex cdiv(final double xr, final double xi, final double yr, final double yi) { return new Complex(xr, xi).divide(new Complex(yr, yi)); }
/** * Performs a division of two complex numbers. * * @param xr real part of the first number * @param xi imaginary part of the first number * @param yr real part of the second number * @param yi imaginary part of the second number * @return result of the complex division */ private Complex cdiv(final double xr, final double xi, final double yr, final double yi) { return new Complex(xr, xi).divide(new Complex(yr, yi)); }
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 static Complex solve_quadratic_2(double a, double b, double c) { return (new Complex(-b).subtract(new Complex(b * b - 4 * a * c, 0)) .sqrt()).divide(2. * a); }
public SV otherSide(double r, double x, double g, double b, double ratio) { Complex z = new Complex(r, x); // z=r+jx Complex y = new Complex(g, b); // y=g+jb Complex s1 = new Complex(p, q); // s1=p1+jq1 Complex u1 = ComplexUtils.polar2Complex(u, Math.toRadians(a)); Complex v1 = u1.divide(Math.sqrt(3f)); // v1=u1/sqrt(3) Complex v1p = v1.multiply(ratio); // v1p=v1*rho Complex i1 = s1.divide(v1.multiply(3)).conjugate(); // i1=conj(s1/(3*v1)) Complex i1p = i1.divide(ratio); // i1p=i1/rho Complex i2 = i1p.subtract(y.multiply(v1p)); // i2=i1p-y*v1p Complex v2 = v1p.subtract(z.multiply(i2)); // v2=v1p-z*i2 Complex s2 = v2.multiply(3).multiply(i2.conjugate()); // s2=3*v2*conj(i2) Complex u2 = v2.multiply(Math.sqrt(3f)); return new SV(-s2.getReal(), -s2.getImaginary(), u2.abs(), Math.toDegrees(u2.getArgument())); }
public StateVariable toSv2(StateVariable sv1) { Complex s1 = new Complex(-sv1.p, -sv1.q); // s1=p1+jq1 Complex u1 = ComplexUtils.polar2Complex(sv1.u, Math.toRadians(sv1.theta)); Complex v1 = u1.divide(SQUARE_3); // v1=u1/sqrt(3) Complex v1p = v1.multiply(ratio); // v1p=v1*rho Complex i1 = s1.divide(v1.multiply(3)).conjugate(); // i1=conj(s1/(3*v1)) Complex i1p = i1.divide(ratio); // i1p=i1/rho Complex i2 = i1p.subtract(y.multiply(v1p)).negate(); // i2=-(i1p-y*v1p) Complex v2 = v1p.subtract(z.multiply(i2)); // v2=v1p-z*i2 Complex s2 = v2.multiply(3).multiply(i2.conjugate()); // s2=3*v2*conj(i2) Complex u2 = v2.multiply(SQUARE_3); return new StateVariable(-s2.getReal(), -s2.getImaginary(), u2.abs(), Math.toDegrees(u2.getArgument())); }
/** * c = csc(a) * * @param a * a * @param c * c */ public static void complexCsch(GeoVec2D a, GeoVec2D c) { Complex out = new Complex(a.x, a.y); out = Complex.ONE.divide(out.sinh()); c.x = out.getReal(); c.y = out.getImaginary(); c.setMode(Kernel.COORD_COMPLEX); }
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())); }
/** * c = cot(a) * * @param a * a * @param c * c */ public static void complexCoth(GeoVec2D a, GeoVec2D c) { Complex out = new Complex(a.x, a.y); out = Complex.ONE.divide(out.tanh()); c.x = out.getReal(); c.y = out.getImaginary(); c.setMode(Kernel.COORD_COMPLEX); }
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)); }
public ValueType log10(CalculatedValue g) { if (g.isComplex() || g.real <= 0.0) { return setComplexValue(g.getComplex().log().divide(FastMath.log(10.0))); } else { return setValue(FastMath.log10(g.real)); } }
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)); }