Example #1
0
        public static NumarComplex ridicareLaPutere(NumarComplex x, int n)
        {
            NumarComplex ridicareLaPutere = new NumarComplex();

            for (int i = 0; i < n; i++)
            {
                ridicareLaPutere = x * x;
            }

            return(ridicareLaPutere);
        }
Example #2
0
        static void Main(string[] args)
        {
            NumarComplex x = new NumarComplex(1, 3);
            NumarComplex y = new NumarComplex(2, 4);

            Console.WriteLine("x = " + x);
            Console.WriteLine("y = " + y);

            NumarComplex z = new NumarComplex();

            z = x + y;
            Console.WriteLine("x + y =  " + z);
            z = x - y;
            Console.WriteLine("x - y = " + z);
            z = x * y;
            Console.WriteLine("x * y = " + z);
            z = NumarComplex.ridicareLaPutere(x, 2);
            Console.WriteLine("x ^ 2 = " + z);

            Console.WriteLine("Forma trigonometrica a lui x este:  " + NumarComplex.formaTrigonometrica(x));
        }
Example #3
0
        public static NumarComplex operator -(NumarComplex x, NumarComplex y)
        {
            NumarComplex d = new NumarComplex(x.ParteIntreaga - y.ParteIntreaga, x.ParteImaginara - y.ParteImaginara);

            return(d);
        }
Example #4
0
        public static NumarComplex operator *(NumarComplex x, NumarComplex y)
        {
            NumarComplex p = new NumarComplex((x.ParteIntreaga * y.ParteIntreaga) - (x.ParteImaginara * y.ParteImaginara), (x.ParteIntreaga * y.ParteImaginara) + (x.ParteImaginara * y.ParteIntreaga));

            return(p);
        }
Example #5
0
        public static NumarComplex operator +(NumarComplex x, NumarComplex y)
        {
            NumarComplex s = new NumarComplex(x.ParteIntreaga + y.ParteIntreaga, x.ParteImaginara + y.ParteImaginara);

            return(s);
        }