コード例 #1
0
 public ComplexNumber sub(ComplexNumber left, ComplexNumber right)
 {
     return(new ComplexNumber(left.real - right.real, left.imaginary - right.imaginary));
 }
コード例 #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)));
 }
コード例 #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)));
 }
コード例 #4
0
 public ComplexNumber add(ComplexNumber left, ComplexNumber right)
 {
     return(new ComplexNumber(left.real + right.real, left.imaginary + right.imaginary));
 }