//MULTIPLICATION public IComplexNumber Multiplication(IComplexNumber numberA, IComplexNumber numberB) { // a+bi * c+di // ac+bci+adi+bdi^2 // ac+bci+adi-bd // ac-bd+bci+adi // (ac-bd)+(bc+ad)i // // http://mathworld.wolfram.com/ComplexMultiplication.html double real = numberA.getPartReal() * numberB.getPartReal() - numberA.getPartComplex() * numberB.getPartComplex(); double complex = numberA.getPartComplex() * numberB.getPartReal() + numberA.getPartReal() * numberB.getPartComplex(); return FactoryComplexNumber.GenerateComplexNumber(real, complex); }
public IComplexNumber Multiplication(IComplexNumber number, double factor) { double real = number.getPartReal() * factor; double complex = number.getPartComplex() * factor; return FactoryComplexNumber.GenerateComplexNumber(real, complex); }
//INVERSE public IComplexNumber Inverse(IComplexNumber number) { double real = 1 / number.getPartReal(); double complex = 1 / number.getPartComplex(); return FactoryComplexNumber.GenerateComplexNumber(real, complex); }
//CONJUGATE public IComplexNumber Conjugate(IComplexNumber number) { double real = number.getPartReal(); double complex = -number.getPartComplex(); return FactoryComplexNumber.GenerateComplexNumber(real, complex); }
//ADDITION public IComplexNumber Add(IComplexNumber numberA, IComplexNumber numberB) { double real = numberA.getPartReal() + numberB.getPartReal(); double complex = numberA.getPartComplex() + numberB.getPartComplex(); return FactoryComplexNumber.GenerateComplexNumber(real, complex); }
//CATEGORIZATION public bool Equals(IComplexNumber number) { return ((this.getPartReal().Equals(number.getPartReal())) && (this.getPartComplex().Equals(number.getPartComplex()))); }
public void Initialize(IComplexNumber number) { setPartReal ( number.getPartReal() ); setPartComplex( number.getPartComplex() ); }
//SIGN REVERSAL public IComplexNumber SignReversal(IComplexNumber number) { double real = -number.getPartReal(); double complex = -number.getPartComplex(); return FactoryComplexNumber.GenerateComplexNumber(real, complex); }
public double PoweredNormEuclidean(IComplexNumber number) { // http://mathworld.wolfram.com/ComplexModulus.html double coefA = System.Math.Pow(number.getPartReal(), 2); double coefB = System.Math.Pow(number.getPartComplex(), 2); return coefA + coefB; // nada de restas ni de valores absolutos }