public ComplexNumber divide(ComplexNumber other) { double tempNumber = other.getA() * other.getA() + other.getB() * other.getB(); ComplexNumber tempComplexNum = new ComplexNumber(other.getA(), -other.getB()); tempComplexNum = multiply(tempComplexNum); return specialDivide(tempComplexNum, tempNumber); }
public ComplexNumber multiply(ComplexNumber other) { double aNew = other.getA() * a - other.getB() * b; double bNew = other.getB() * a + other.getA() * b; ComplexNumber newComplexNum = new ComplexNumber(aNew, bNew); return newComplexNum; }
public ComplexNumber subtract(ComplexNumber other) { ComplexNumber newComplexNum = new ComplexNumber(-other.getA(), -other.getB()); newComplexNum = add(newComplexNum); return newComplexNum; }
public ComplexNumber specialDivide(ComplexNumber a, double b) { double aNew = a.getA() / b; double bNew = a.getB() / b; ComplexNumber newComplexNum = new ComplexNumber(aNew, bNew); return newComplexNum; }
public ComplexNumber add(ComplexNumber other) { double aNew = other.getA() + a; double bNew = other.getB() + b; ComplexNumber newComplexNum = new ComplexNumber(aNew, bNew); return newComplexNum; }