public static void Lmatch_Z(Complex ZA, Complex ZB, bool isLP, double freq, out double L, out double C)
        {
            //Calculate Xs s/t GA,new = GB.
            //Add shunt susceptance s/t ZA = ZB.

            Complex YA = 1 / ZA;
            Complex YB = 1 / ZB;

            double a = YB.Real;
            double b = YB.Real * 2 * ZA.Imaginary;
            double c = YB.Real * ZA.Imaginary * ZA.Imaginary + YB.Real * ZA.Real * ZA.Real - ZA.Real;

            double Xs_Add;
            double Xs_Sub;

            MenialOperations.Quadratic(a, b, c, out Xs_Add, out Xs_Sub);

            double Xs = 0;

            //If this is a lowpass match, Xs needs > 0.
            if (isLP)
            {
                Xs = Xs_Add > 0 ? Xs_Add : Xs_Sub;
                Conversions.XtoComponent(Xs, freq, out L);

                Complex YA_Prime = 1 / (ZA + new Complex(0, Xs));
                double  Bp       = YB.Imaginary - YA_Prime.Imaginary;

                Conversions.BtoComponent(Bp, freq, out C);
            }
            //If this is a highpass match, Xs needs < 0.
            else
            {
                Xs = Xs_Add < 0 ? Xs_Add : Xs_Sub;
                Conversions.XtoComponent(Xs, freq, out C);

                Complex YA_Prime = 1 / (ZA + new Complex(0, Xs));
                double  Bp       = YB.Imaginary - YA_Prime.Imaginary;

                Conversions.BtoComponent(Bp, freq, out L);
            }
        }
        public static void Lmatch_Y(Complex YA, Complex YB, bool isLP, double freq, out double L, out double C)
        {
            Complex ZA = 1 / YA;
            Complex ZB = 1 / YB;

            double a = ZB.Real;
            double b = ZB.Real * 2 * YA.Imaginary;
            double c = ZB.Real * YA.Imaginary * YA.Imaginary + ZB.Real * YA.Real * YA.Real - YA.Real;

            double Bp_Add;
            double Bp_Sub;

            MenialOperations.Quadratic(a, b, c, out Bp_Add, out Bp_Sub);

            double Bp = 0;

            //If this is a lowpass match, Bp needs > 0.
            if (isLP)
            {
                Bp = Bp_Add > 0 ? Bp_Add : Bp_Sub;
                Conversions.BtoComponent(Bp, freq, out C);

                Complex ZA_Prime = 1 / (YA + new Complex(0, Bp));
                double  Xs       = ZB.Imaginary - ZA_Prime.Imaginary;

                Conversions.XtoComponent(Xs, freq, out L);
            }
            //If this is a highpass match, Bp needs < 0.
            else
            {
                Bp = Bp_Add < 0 ? Bp_Add : Bp_Sub;
                Conversions.BtoComponent(Bp, freq, out L);

                Complex ZA_Prime = 1 / (YA + new Complex(0, Bp));
                double  Xs       = ZB.Imaginary - ZA_Prime.Imaginary;

                Conversions.XtoComponent(Xs, freq, out C);
            }
        }