using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LiczbyZespolone
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Complex i = Complex.I;
            MessageBox.Show("i=" + i.ToString() + "=" + i.ToStringI() + "\n" + i.ToStringPolar());
            
            Complex z = 1 + i;				    //1+i
            z = z.Conj;				            //1-i
            z /= 2; 					        //0.5-0.5i            
            MessageBox.Show("Conj, z=" + z.ToString() + "=" + z.ToStringI() + "\n" + z.ToStringPolar());

            z = 1;
            z /= Complex.I;                     //-i
            MessageBox.Show("Operator /, z=" + z.ToString() + "=" + z.ToStringI() + "\n" + z.ToStringPolar());

            z = Complex.Sqrt(i);			    //0.707107(1+i)
            MessageBox.Show("Sqrt, z=" + z.ToString() + "=" + z.ToStringI() + "\n" + z.ToStringPolar());

            Double faza = Complex.Arg(i);		//PI/2=1.5708
            Double promien = Complex.Abs(i);	//1
            MessageBox.Show("promien=" + promien.ToString() + ", faza=" + faza.ToString());

            z = Complex.Sin(i);			        //iSinh(1)=1.1752i
            MessageBox.Show("Sin, z=" + z.ToString() + "=" + z.ToStringI() + "\n" + z.ToStringPolar());

            z = Complex.Atan(i);			    //nieskonczonosc "w kierunku" +i
            MessageBox.Show("Atan, z=" + z.ToString() + "=" + z.ToStringI() + "\n" + z.ToStringPolar());

            z = i * i;					        //-1
            MessageBox.Show("^2, z=" + z.ToString() + "=" + z.ToStringI() + "\n" + z.ToStringPolar());

            z = Complex.Pow(i, 2);			    //-1, ale mozliwy maly blad
            MessageBox.Show("Pow 2, z=" + z.ToString() + "=" + z.ToStringI() + "\n" + z.ToStringPolar());
        }
    }
}
