Example #1
0
        public static void giaiptbac_sophuc()
        {
            string nhap;
            var    a = new So_phuc();
            var    b = new So_phuc();
            var    c = new So_phuc();

            Console.Write("nhap he so a:");
            nhap = Console.ReadLine();
            a.chuyendoi(nhap);
            Console.Write("nhap he so b:");
            nhap = Console.ReadLine();
            b.chuyendoi(nhap);
            Console.Write("nhap he so c:");
            nhap = Console.ReadLine();
            c.chuyendoi(nhap);
            So_phuc delta = b * b + (-4) * a * c;

            delta.in_giatri();
            Console.Write("\n");
            delta = delta.Sqrl();
            delta.in_giatri();
            So_phuc x1, x2, d;

            d  = -b + delta;
            x1 = (-b + delta) / (2 * a);
            x2 = (-b - delta) / (2 * a);
            Console.Write("\nx1=");
            x1.in_giatri();
            Console.Write("\nx2=");
            x2.in_giatri();
        }
Example #2
0
            public So_phuc lien_hop()
            {
                So_phuc c = new So_phuc();

                c.thuc = this.thuc;
                c.ao   = -this.ao;
                return(c);
            }
Example #3
0
            public So_phuc nghichdao()
            {
                So_phuc a = new So_phuc();

                a.thuc = this.thuc / (this.modun());
                a.ao   = -this.ao / this.modun();
                return(a);
            }
Example #4
0
            public So_phuc Sqrl()
            {
                So_phuc c     = new So_phuc();
                double  delta = this.modun();

                c.thuc = Math.Sqrt((this.thuc + delta) / 2);
                c.ao   = this.ao / c.thuc / 2;
                return(c);
            }
Example #5
0
            public static So_phuc operator /(So_phuc so_bi_chia, So_phuc so_chia)
            {
                So_phuc thuong = new So_phuc();

                thuong      = so_chia.lien_hop();
                thuong      = thuong * so_bi_chia;
                thuong.thuc = thuong.thuc / (so_chia.thuc * so_chia.thuc + so_chia.ao * so_chia.ao);
                thuong.ao   = thuong.ao / (so_chia.thuc * so_chia.thuc + so_chia.ao * so_chia.ao);
                return(thuong);
            }