コード例 #1
0
        public ComplexStruct Add(ComplexStruct x2)
        {
            ComplexStruct x3 = new ComplexStruct();

            x3.re = re + x2.re;
            x3.im = im + x2.im;
            return(x3);
        }
コード例 #2
0
        public ComplexStruct Devide(ComplexStruct x2)
        {
            ComplexStruct x3 = new ComplexStruct();

            x3.re = (re * x2.re + im * x2.im) / (Math.Pow(x2.re, 2) + Math.Pow(x2.im, 2));
            x3.im = (x2.re * im - re * x2.im) / (Math.Pow(x2.re, 2) + Math.Pow(x2.im, 2));
            return(x3);
        }
コード例 #3
0
        public ComplexStruct Multiply(ComplexStruct x2)
        {
            ComplexStruct x3 = new ComplexStruct();

            x3.re = re * x2.re - im * x2.im;
            x3.im = re * x2.im + x2.re * im;
            return(x3);
        }
コード例 #4
0
        public ComplexStruct Substract(ComplexStruct x2)
        {
            ComplexStruct x3 = new ComplexStruct();

            x3.re = re - x2.re;
            x3.im = im - x2.im;
            return(x3);
        }