コード例 #1
0
ファイル: MainForm.cs プロジェクト: bayger/hrt
        private Dictionary <double, double> GenerateSigmaSeries(Action <double, Thetas> thetasUpdater, Thetas thetas)
        {
            var results = new Dictionary <double, double>();
            var sigma0  = (double)numSigma0.Value;
            var tau     = (double)numTau.Value;

            for (double angle = 0; angle <= 90.0; angle += 0.1)
            {
                thetasUpdater(angle, thetas);

                var thetaI = thetas.I / 180 * Math.PI;
                var thetaR = thetas.R / 180 * Math.PI;

                var Ki = Math.Tan(thetaI) * MMath.Erfc(tau / (2 * sigma0) / Math.Tan(thetaI));
                var Kr = Math.Tan(thetaR) * MMath.Erfc(tau / (2 * sigma0) / Math.Tan(thetaR));
                var K  = (Ki + Kr) / 4;

                var y     = 2 * K * K / Math.PI;
                var x     = solve_xexpx(y);
                var sigma = sigma0 / Math.Sqrt(1 + x);
                results.Add(angle, sigma);
            }

            return(results);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: bayger/hrt
        private void updateZ()
        {
            var sigma0 = (double)numSigma0.Value;
            var thetaI = (double)numThetaI.Value / 180 * Math.PI;
            var thetaK = (double)numThetaK.Value / 180 * Math.PI;
            var tau    = (double)numTau.Value;

            var Ki = Math.Tan(thetaI) * MMath.Erfc(tau / (2 * sigma0) / Math.Tan(thetaI));
            var Kr = Math.Tan(thetaK) * MMath.Erfc(tau / (2 * sigma0) / Math.Tan(thetaK));
            var K  = (Ki + Kr) / 4;

            var y  = 2 * K * K / Math.PI;
            var x  = solve_xexpx(y);
            var zz = x * sigma0 * sigma0;
            var z1 = -Math.Sqrt(zz);
            var z2 = Math.Sqrt(zz);

            numZ.Text = Math.Abs(z1).ToString();

            var left1 = Math.Sqrt(Math.PI / 2) * z1;
            var left2 = Math.Sqrt(Math.PI / 2) * z2;
            var right = sigma0 * K / Math.Sqrt(Math.Exp(zz / (sigma0 * sigma0)));

            var d1 = Math.Abs(left1 - right);
            var d2 = Math.Abs(left2 - right);
            var d  = d1 < d2 ? d1 : d2;

            verifyZ.Text  = string.Format("±{0:p8}", Math.Abs(d / right));
            textBoxK.Text = K.ToString();

            var sigma = calcedSigma = sigma0 / Math.Sqrt(1 + x);

            textBoxSigma.Text = sigma.ToString("0.000000000000");

            var sinI = Math.Sin(thetaI);
            var sinR = Math.Sin(thetaK);
            var vxy  = Math.Sqrt(sinI * sinI + sinR * sinR);

            numVxy.Value = (decimal)vxy;

            var g = (2 * Math.PI * calcedSigma / (double)numLambda.Value) *
                    (Math.Cos(thetaI) + Math.Cos(thetaK));

            g         *= g;
            numG.Value = (decimal)g;

            CalcSums();
        }