Пример #1
0
        static public ComplexNumber DivisionComplexNumbers(ComplexNumber complexNumberNumerator, ComplexNumber complexNumberDenominator)
        {
            //частное комплексных числел
            double newImagPart;
            double newRealPart;


            double newDenominatorPart;

            //x+y*i = Z; u+v*i = C
            //рез выпажение состоит из 2 частей: realpart = .(x*u + y*v) + ImgPart = .(y*u - x*v)*i

            newDenominatorPart = (Math.Pow(complexNumberDenominator.realPart, 2) + Math.Pow(complexNumberDenominator.imaginaryPart, 2));

            newRealPart = (complexNumberNumerator.realPart * complexNumberDenominator.realPart +
                           complexNumberNumerator.imaginaryPart * complexNumberDenominator.imaginaryPart) / newDenominatorPart;
            newImagPart = (complexNumberNumerator.imaginaryPart * complexNumberDenominator.realPart -
                           complexNumberNumerator.realPart * complexNumberDenominator.imaginaryPart) / newDenominatorPart;

            ComplexNumber resultOfDivisionComplexNumber = new ComplexNumber(newImagPart, newImagPart);

            return(resultOfDivisionComplexNumber);
        }
Пример #2
0
        static public ComplexNumber SubstractComplexNumbers(ComplexNumber complexNumberFirst, ComplexNumber complexNumberSecond)
        {
            //разность комплексных числел

            double newImagPart;
            double newRealPart;

            newImagPart = complexNumberFirst.imaginaryPart - complexNumberSecond.imaginaryPart;
            newRealPart = complexNumberFirst.realPart - complexNumberSecond.realPart;
            ComplexNumber resultOfSubstrationComplexNumber = new ComplexNumber(newRealPart, newImagPart);

            return(resultOfSubstrationComplexNumber);
        }
Пример #3
0
        static public ComplexNumber MutiplicationComplexNumbers(ComplexNumber complexNumberFirst, ComplexNumber complexNumberSecond)
        {
            //произведение комплексных числел

            double newImagPart;
            double newRealPart;

            //x+y*i = Z; u+v*i = C
            //рез выпажение состоит из 2 частей: realpart = .(x*u - y*v) + ImgPart = .(x*v + y*u)*i

            newRealPart = complexNumberFirst.realPart * complexNumberSecond.realPart -
                          complexNumberFirst.imaginaryPart * complexNumberSecond.imaginaryPart;
            newImagPart = complexNumberFirst.realPart * complexNumberSecond.imaginaryPart +
                          complexNumberFirst.imaginaryPart * complexNumberSecond.realPart;

            ComplexNumber resultOfMutiplicationComplexNumber = new ComplexNumber(newRealPart, newImagPart);

            return(resultOfMutiplicationComplexNumber);
        }
Пример #4
0
        static public ComplexNumber SumComplexNumbers(ComplexNumber complexNumberFirst, ComplexNumber complexNumberSecond)
        {
            //сумма комплексных числел

            double newImagPart;
            double newRealPart;

            newImagPart = complexNumberFirst.imaginaryPart + complexNumberSecond.imaginaryPart;
            newRealPart = complexNumberFirst.realPart + complexNumberSecond.realPart;
            ComplexNumber resultOfSumComplexNumber = new ComplexNumber(newRealPart, newImagPart);

            return(resultOfSumComplexNumber);
        }