예제 #1
0
 public static void PomnozPrzezStala(Macierz m, double con)
 {
     m.a11 = m.a11 * con;
     m.a12 = m.a12 * con;
     m.a21 = m.a21 * con;
     m.a22 = m.a22 * con;
 }
예제 #2
0
        public static Macierz PomnozMacierze(Macierz m, Macierz w)
        {
            double x11, x12, x21, x22;

            x11 = m.a11 * w.a11 + m.a12 * w.a21;
            x12 = m.a11 * w.a12 + m.a12 * w.a22;
            x21 = m.a21 * w.a11 + m.a22 * w.a21;
            x22 = m.a21 * w.a12 + m.a22 * w.a22;
            return(new Macierz(x11, x12, x21, x22));
        }
예제 #3
0
        public static Macierz DodajMacierze(Macierz m, Macierz w)
        {
            double x11, x12, x21, x22;

            x11 = m.a11 + w.a11;
            x12 = m.a12 + w.a12;
            x21 = m.a21 + w.a21;
            x22 = m.a22 + w.a22;
            return(new Macierz(x11, x12, x21, x22));
        }
예제 #4
0
        static void Main(string[] args)
        {
            Macierz m = new Macierz(1, 2, 3, 4);

            m.Wyswietl();
            Macierz w = new Macierz(2, 4, 6, 8);

            w.Wyswietl();
            Macierz.DodajMacierze(m, w).Wyswietl();
            Macierz.PomnozMacierze(m, w).Wyswietl();
            Macierz.OdwrocMacierz(m);
            m.Wyswietl();
        }
예제 #5
0
        public static void OdwrocMacierz(Macierz m)
        {
            double od_det = 1 / (m.a11 * m.a22 - m.a12 * m.a21);
            double bufor  = m.a22;

            m.a22  = m.a11;
            m.a11  = bufor;
            m.a12 *= -1;
            m.a21 *= -1;
            m.a11 *= od_det;
            m.a12 *= od_det;
            m.a21 *= od_det;
            m.a22 *= od_det;
        }