public static double[] DGD(string j1, string j2, double w1, double w2) { double[] jValues1 = JonesString2Double(j1); double[] jValues2 = JonesString2Double(j2); JonesMatPol mat1 = JonesDoubleArray2JonesMat(jValues1); JonesMatPol mat2 = JonesDoubleArray2JonesMat(jValues2); JonesMatCar J1 = CMath.Pol2Car(mat1); JonesMatCar J2 = CMath.Pol2Car(mat2); JonesMatCar J1Inv = CMath.Inverse(J1); JonesMatCar J2_J1Inv = J2 * J1Inv; ComplexCar[] complexCars = CMath.Eigenvalues(J2_J1Inv); ComplexPol[] complexPols = new ComplexPol[2]; complexPols[0] = CMath.Car2Pol(complexCars[0]); complexPols[1] = CMath.Car2Pol(complexCars[1]); double Ang = complexPols[0].ang - complexPols[1].ang; double f1 = Wavelength2Frequency(w1); double f2 = Wavelength2Frequency(w2); double[] DGD_W = { CMath.Abs(Ang / (f1 - f2)), (w1 + w2) / 2 }; return(DGD_W); }
public static ComplexCar Pol2Car(ComplexPol complexPol) { ComplexCar complexCar; complexCar.real = complexPol.mod * Math.Cos(complexPol.ang); complexCar.imag = complexPol.mod * Math.Sin(complexPol.ang); return(complexCar); }
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); }
public static void Print(ComplexPol complexPol) { Console.Write(complexPol.mod + " |_" + complexPol.ang); }