/** * Return the log value of the given complex number * * @param num the number to getScalar the absolute value for * @return the absolute value of this complex number */ public static IComplexNumber neg(IComplexNumber num) { Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).negate(); return Nd4j.createDouble(c.getReal(), c.getImaginary()); }
/** * 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/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()); }
for (Complex aP : p) temp = temp.multiply(aP.negate());
/** * @return */ public ComplexNum negate() { return newInstance(fComplex.negate()); }
/** * @return */ @Override public IExpr opposite() { return newInstance(fComplex.negate()); }
/** * Return the log value of the given complex number * * @param num the number to getScalar the absolute value for * @return the absolute value of this complex number */ public static IComplexNumber neg(IComplexNumber num) { Complex c = new Complex(num.realComponent().doubleValue(), num.imaginaryComponent().doubleValue()).negate(); return Nd4j.createDouble(c.getReal(), c.getImaginary()); }
/** * 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 (notDefined) { return NaN; } return this.add(this.sqrt1z().multiply(I)).log().multiply(I.negate()); }
/** * 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/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()); }
/** * 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()); }
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())); }
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())); }
public static Complex calcStarVoltage(ThreeWindingsTransformer twt, double ratedU0) { Objects.requireNonNull(twt); Complex v1 = ComplexUtils.polar2Complex(getV(twt.getLeg1()), getTheta(twt.getLeg1())); Complex v2 = ComplexUtils.polar2Complex(getV(twt.getLeg2()), getTheta(twt.getLeg2())); Complex v3 = ComplexUtils.polar2Complex(getV(twt.getLeg3()), getTheta(twt.getLeg3())); Complex ytr1 = new Complex(twt.getLeg1().getR(), twt.getLeg1().getX()).reciprocal(); Complex ytr2 = new Complex(adjustedR(twt.getLeg2()), adjustedX(twt.getLeg2())).reciprocal(); Complex ytr3 = new Complex(adjustedR(twt.getLeg3()), adjustedX(twt.getLeg3())).reciprocal(); Complex a01 = new Complex(1, 0); Complex a1 = new Complex(twt.getLeg1().getRatedU() / ratedU0, 0); Complex a02 = new Complex(1, 0); Complex a2 = new Complex(1 / rho(twt.getLeg2(), ratedU0), 0); Complex a03 = new Complex(1, 0); Complex a3 = new Complex(1 / rho(twt.getLeg3(), ratedU0), 0); // IIDM model includes admittance to ground at star bus side in Leg1 Complex ysh01 = new Complex(twt.getLeg1().getG(), twt.getLeg1().getB()); Complex ysh02 = new Complex(0, 0); Complex ysh03 = new Complex(0, 0); Complex y01 = ytr1.negate().divide(a01.conjugate().multiply(a1)); Complex y02 = ytr2.negate().divide(a02.conjugate().multiply(a2)); Complex y03 = ytr3.negate().divide(a03.conjugate().multiply(a3)); Complex y0101 = ytr1.add(ysh01).divide(a01.conjugate().multiply(a01)); Complex y0202 = ytr2.add(ysh02).divide(a02.conjugate().multiply(a02)); Complex y0303 = ytr3.add(ysh03).divide(a03.conjugate().multiply(a03)); return y01.multiply(v1).add(y02.multiply(v2)).add(y03.multiply(v3)).negate() .divide(y0101.add(y0202).add(y0303)); }
Bus calcStarBusV1V2V3Y(BranchTestCase w1, BranchTestCase w2, BranchTestCase w3) { Complex v1 = ComplexUtils.polar2Complex(w1.bus1.u, w1.bus1.theta); Complex v2 = ComplexUtils.polar2Complex(w2.bus1.u, w2.bus1.theta); Complex v3 = ComplexUtils.polar2Complex(w3.bus1.u, w3.bus1.theta); Complex ytr1 = new Complex(w1.branch.end1.r, w1.branch.end1.x).reciprocal(); Complex ytr2 = new Complex(w2.branch.end1.r, w2.branch.end1.x).reciprocal(); Complex ytr3 = new Complex(w3.branch.end1.r, w3.branch.end1.x).reciprocal(); // FIXME consider tap.rho and tap.alpha Complex a01 = new Complex(w1.branch.end2.ratedU / w1.branch.end1.ratedU, 0); Complex a1 = new Complex(1, 0); Complex a02 = new Complex(w2.branch.end2.ratedU / w2.branch.end1.ratedU, 0); Complex a2 = new Complex(1, 0); Complex a03 = new Complex(w3.branch.end2.ratedU / w3.branch.end1.ratedU, 0); Complex a3 = new Complex(1, 0); Complex ysh01 = new Complex(w1.branch.end2.g, w1.branch.end2.b); Complex ysh02 = new Complex(w2.branch.end2.g, w2.branch.end2.b); Complex ysh03 = new Complex(w3.branch.end2.g, w3.branch.end2.b); Complex y01 = ytr1.negate().divide(a01.conjugate().multiply(a1)); Complex y02 = ytr2.negate().divide(a02.conjugate().multiply(a2)); Complex y03 = ytr3.negate().divide(a03.conjugate().multiply(a3)); Complex y0101 = ytr1.add(ysh01).divide(a01.conjugate().multiply(a01)); Complex y0202 = ytr2.add(ysh02).divide(a02.conjugate().multiply(a02)); Complex y0303 = ytr3.add(ysh03).divide(a03.conjugate().multiply(a03)); Complex v0 = y01.multiply(v1).add(y02.multiply(v2)).add(y03.multiply(v3)).negate() .divide(y0101.add(y0202).add(y0303)); Bus starBus = new Bus(); starBus.u = v0.abs(); starBus.theta = v0.getArgument(); return starBus; }
Complex y12 = ytr.divide(a1.conjugate().multiply(a2)).negate();