Package org.jamesii.core.math.complex

Examples of org.jamesii.core.math.complex.Complex


        && (abs(a.getArgument() - b.getArgument()) < EPSILON);
  }

  /** Tests the {@link Complex#Complex()} constructor. */
  public void testEmptyConstructor() {
    checkFields(new Complex(), 0, 0, 0, 0);
  }
View Full Code Here


    checkFields(new Complex(), 0, 0, 0, 0);
  }

  /** Tests the {@link Complex#Complex(double)} constructor. */
  public void testRealConstructor() {
    checkFields(new Complex(5), 5, 0, 5, 0);
    checkFields(new Complex(-2), -2, 0, 2, PI);
    checkFields(new Complex(0), 0, 0, 0, 0);
  }
View Full Code Here

    checkFields(new Complex(0), 0, 0, 0, 0);
  }

  /** Tests the {@link Complex#Complex(double, double)} constructor. */
  public void testRealImaginaryConstructor() {
    checkFields(new Complex(1, 1), 1, 1, sqrt(2), .25 * PI);
    checkFields(new Complex(0, 4), 0, 4, 4, .5 * PI);
    checkFields(new Complex(-7, 0), -7, 0, 7, PI);
    checkFields(new Complex(0, 0), 0, 0, 0, 0);
  }
View Full Code Here

    checkFields(new Complex(0, 0), 0, 0, 0, 0);
  }

  /** Tests the static {@link Complex#fromPolar(double, double)} method. */
  public void testFromPolar() {
    Complex c = Complex.fromPolar(5, 0);
    checkFields(c, 5, 0, 5, 0);
    c = Complex.fromPolar(4, PI / 2);
    checkFields(c, 0, 4, 4, PI / 2);
    c = Complex.fromPolar(sqrt(2), PI / 4);
    checkFields(c, 1, 1, sqrt(2), PI / 4);
View Full Code Here

        -0.5309649149);
  }

  /** Tests the {@link Complex#negate()} method. */
  public void testNegate() {
    checkFields(new Complex(1, 2).negate(), -1, -2, sqrt(5), -2.034443936);
  }
View Full Code Here

    checkFields(new Complex(1, 2).negate(), -1, -2, sqrt(5), -2.034443936);
  }

  /** Tests the {@link Complex#conjugate()} method. */
  public void testConjugate() {
    checkFields(new Complex(1, 1).conjugate(), 1, -1, sqrt(2), -.25 * PI);
  }
View Full Code Here

    checkFields(new Complex(1, 1).conjugate(), 1, -1, sqrt(2), -.25 * PI);
  }

  /** Tests the {@link Complex#add(Complex)} method. */
  public void testAdd() {
    checkFields(new Complex(1, 1).add(new Complex(7, -4)), 8, -3, sqrt(73),
        -0.3587706703);
  }
View Full Code Here

        -0.3587706703);
  }

  /** Tests the {@link Complex#subtract(Complex)} method. */
  public void testSubtract() {
    checkFields(new Complex(1, 1).subtract(new Complex(5, -4)), -4, 5,
        sqrt(41), 2.245537269);
  }
View Full Code Here

        sqrt(41), 2.245537269);
  }

  /** Tests the {@link Complex#multiply(double)} method. */
  public void testMultiplyReal() {
    checkFields(new Complex(1, 4).multiply(.1), .1, .4, sqrt(17) / 10,
        1.325817664);
    checkFields(new Complex(1.2, 5).multiply(8.4), 252d / 25, 42, 43.19266604,
        1.335251346);
  }
View Full Code Here

        1.335251346);
  }

  /** Tests the {@link Complex#multiply(Complex)} method. */
  public void testMultiplyComplex() {
    checkFields(new Complex(7, 5).multiply(new Complex(-2, 8)), -54, 46,
        70.9365914, 2.436024476);
    checkFields(new Complex(1, 2).multiply(new Complex(0, 0)), 0, 0, 0, 0);
    checkFields(new Complex(1.2, -5).multiply(new Complex(-0.1, -4)),
        -503d / 25, -43d / 10, 20.57436269, -2.931042466);
  }
View Full Code Here

TOP

Related Classes of org.jamesii.core.math.complex.Complex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.