Example #1
0
 public ComplexNumber sub(ComplexNumber left, ComplexNumber right)
 {
     return(new ComplexNumber(left.real - right.real, left.imaginary - right.imaginary));
 }
Example #2
0
 public ComplexNumber div(ComplexNumber left, ComplexNumber right)
 {
     return(new ComplexNumber(
                (left.real * right.real + left.imaginary * right.imaginary) / (right.real * right.real + right.imaginary * right.imaginary),
                (-left.real * right.imaginary + left.imaginary * right.real) / (right.real * right.real + right.imaginary * right.imaginary)));
 }
Example #3
0
 public ComplexNumber mult(ComplexNumber left, ComplexNumber right)
 {
     return(new ComplexNumber(
                (left.real * right.real - left.imaginary * right.imaginary),
                (left.real * right.imaginary + left.imaginary * right.real)));
 }
Example #4
0
 public ComplexNumber add(ComplexNumber left, ComplexNumber right)
 {
     return(new ComplexNumber(left.real + right.real, left.imaginary + right.imaginary));
 }