public static Zespolona Podziel(Zespolona x, Zespolona y) { double wynikR = (x.a * y.a + x.b * y.b) / (y.a * y.a + y.b * y.b); double wynikU = (x.b * y.a - x.a * y.b) / (y.a * y.a + y.b * y.b); Zespolona wynik = new Zespolona(wynikR, wynikU); return(wynik); }
public static Zespolona Odejmij(Zespolona x, Zespolona y) { double wynikR = x.a - y.a; double wynikU = x.b - y.b; Zespolona wynik = new Zespolona(wynikR, wynikU); return(wynik); }
public static Zespolona Pomnoz(Zespolona x, Zespolona y) { double wynikR = x.a * y.a - x.b * y.b; double wynikU = x.a * y.b + x.b * y.a; Zespolona wynik = new Zespolona(wynikR, wynikU); return(wynik); }
public static Zespolona Dodaj(Zespolona x, Zespolona y) { double wynikR = x.a + y.a; double wynikU = x.b + y.b; Zespolona wynik = new Zespolona(wynikR, wynikU); return(wynik); }
static void Main(string[] args) { Zespolona z1 = new Zespolona(1, 2); Zespolona z2 = new Zespolona(3, 4); Zespolona z3 = Zespolona.Dodaj(z1, z2); Console.WriteLine(z3.Re); Console.WriteLine(z3.Imag); }