예제 #1
0
 public static Complex QuoteOf(Complex X, Complex Y) {
   double e = Math.pow(Y.real, 2) + Math.pow(Y.imag, 2);
   Complex Z = new Complex();
   Z.setReal((X.real * Y.real + X.imag * Y.imag) / e);
   Z.setImag((X.imag * Y.real - X.real * Y.imag) / e);
   return Z;
 }
예제 #2
0
 public static void main(String[] args) {
   new Complex(2, 4).printNum();
   new Complex(6, 7).addNum(new Complex(4, 6)).printNum();
   new Complex(6, 7).multiplyNum(new Complex(4, 6)).printNum();
   Complex c = new Complex(4, 7);
   c.setImag(6);
   c.setReal(3);
   c.printNum();
 }
예제 #3
0
 public static Complex DiffOf(Complex X, Complex Y) {
   Complex Z = new Complex();
   Z.setReal(X.real - Y.real);
   Z.setImag(X.imag - Y.imag);
   return Z;
 }
예제 #4
0
 public static Complex prodOf(Complex X, Complex Y) {
   Complex Z = new Complex();
   Z.setReal(X.real * Y.real - X.imag * Y.imag);
   Z.setImag(X.real * Y.imag + X.imag * Y.real);
   return Z;
 }
예제 #5
0
 public static Complex sumOf(Complex X, Complex Y) {
   Complex Z = new Complex();
   Z.setReal(X.real + Y.real);
   Z.setImag(X.imag + Y.imag);
   return Z;
 }