예제 #1
0
        public static ComplexCar Sqrt(ComplexCar complexCar)
        {
            ComplexPol complexPol = Car2Pol(complexCar);
            ComplexCar complex;

            complex.real = Math.Sqrt(complexPol.mod) * Math.Cos(complexPol.ang / 2);
            complex.imag = Math.Sqrt(complexPol.mod) * Math.Sin(complexPol.ang / 2);

            return(complex);
        }
예제 #2
0
 public static void Print(ComplexCar complexCar)
 {
     if (complexCar.imag >= 0)
     {
         Console.Write(complexCar.real + " +" + complexCar.imag + " i");
     }
     else
     {
         Console.Write(complexCar.real + " " + complexCar.imag + " i");
     }
 }
예제 #3
0
        public static ComplexCar TanPiDelta2K(double delta, double tanPi)//Delta in deg
        {
            ComplexCar complexCar = new ComplexCar();

            double r     = 1 / tanPi;
            double theta = -1 * CMath.Deg2Red(delta);

            complexCar.real = r * Math.Cos(theta);
            complexCar.imag = r * Math.Sin(theta);

            return(complexCar);
        }
예제 #4
0
        public static ComplexCar Stokes2K(double s1, double s2, double s3, double s0 = 1)
        {
            ComplexCar complexCar = new ComplexCar();

            double r     = Math.Sqrt((s0 + s1) / (s0 - s1));
            double theta = -1 * Math.Atan(s3 / s2);

            complexCar.real = r * Math.Cos(theta);
            complexCar.imag = r * Math.Sin(theta);

            return(complexCar);
        }
예제 #5
0
        public static ComplexCar[] Eigenvalues(JonesMatCar jonesMatCar)
        {
            ComplexCar[] complexCar = new ComplexCar[2];

            ComplexCar a = (jonesMatCar.J11 + jonesMatCar.J22);
            ComplexCar b = Sqrt((a * a) + (4 * ((jonesMatCar.J12 * jonesMatCar.J21) - (jonesMatCar.J11 * jonesMatCar.J22))));

            complexCar[0] = (a + b) / 2;
            complexCar[1] = (a - b) / 2;

            return(complexCar);
        }
예제 #6
0
        public static JonesMatCar Inverse(JonesMatCar jonesMatCar)
        {
            JonesMatCar JInv;
            ComplexCar  JDet = Det(jonesMatCar);

            JInv.J11 = jonesMatCar.J22 / JDet;
            JInv.J12 = (-1 * jonesMatCar.J12) / JDet;
            JInv.J21 = (-1 * jonesMatCar.J21) / JDet;
            JInv.J22 = jonesMatCar.J11 / JDet;

            return(JInv);
        }
예제 #7
0
        public static JonesMatCar K2JonesMat(ComplexCar k0, ComplexCar k90, ComplexCar k45)
        {
            JonesMatCar jonesMatCar = new JonesMatCar();

            ComplexCar k4 = (k90 - k45) / (k45 - k0);

            jonesMatCar.J11 = k0 * k4;
            jonesMatCar.J12 = k90;
            jonesMatCar.J21 = k4;
            jonesMatCar.J22 = new ComplexCar(1, 0);

            return(jonesMatCar);
        }
예제 #8
0
        public static ComplexPol Car2Pol(ComplexCar complexCar)
        {
            ComplexPol complexPol;

            complexPol.mod = Math.Sqrt(
                (complexCar.real * complexCar.real) +
                (complexCar.imag * complexCar.imag)
                );

            complexPol.ang = Math.Atan2(complexCar.imag, complexCar.real);

            return(complexPol);
        }
예제 #9
0
        static JonesMatCar MesurTanPiDelta2JonesMat(Device Source, Device PolarizationAnalyzer, double wavelenght, int delay)
        {
            Console.WriteLine("Set Source  WL - " + wavelenght.ToString());
            Source.Write(Utility.ReplaceCommonEscapeSequences(MsgWaveLenghtSrc(wavelenght)));//change wavelength source

            Console.WriteLine("Set PAT9000 WL - " + wavelenght.ToString());
            PolarizationAnalyzer.Write(Utility.ReplaceCommonEscapeSequences(MsgWaveLenghtPol(wavelenght)));//change wavelength pol
            System.Threading.Thread.Sleep(delay);

            ComplexCar k0  = TanPiDelta2KMesure(PolarizationAnalyzer, 0);
            ComplexCar k45 = TanPiDelta2KMesure(PolarizationAnalyzer, 45);
            ComplexCar k90 = TanPiDelta2KMesure(PolarizationAnalyzer, 90);

            Console.WriteLine();

            return(Utility.K2JonesMat(k0, k90, k45));
        }
예제 #10
0
        static void Main(string[] args)
        {
            //Mesure();

            double[] values1 = Utility.SC2EybyExDelta(Utility.text_SC1);
            double[] values2 = Utility.SC2EybyExDelta(Utility.text_SC2);
            double[] values3 = Utility.SC2EybyExDelta(Utility.text_SC3);

            ComplexCar k1 = Utility.TanPiDelta2K(values1[1], values1[2]);
            ComplexCar k2 = Utility.TanPiDelta2K(values2[1], values2[2]);
            ComplexCar k3 = Utility.TanPiDelta2K(values3[1], values3[2]);

            JonesMatCar mat = Utility.K2JonesMat(k1, k2, k3);

            CMath.Print(mat);

            Console.Read();
        }
예제 #11
0
 public static double Abs(ComplexCar complexCar)
 {
     return(Math.Sqrt((complexCar.real * complexCar.real) + (complexCar.imag * complexCar.imag)));
 }