示例#1
0
        public void ShootingTest()
        {
            var bvp = BoundaryValueProblem.Problem1;
            var f   = bvp.Equation;

            double a = 0, b = 9, ya = 0, yb = 0, z0 = 4, z1 = -4;

            var solution = ShootingMethod.Solve(f, a, b, ya, yb, z0, z1, 0.1);

            var approxYb = solution(b);

            Assert.AreEqual(yb, approxYb, 0.001);
        }
示例#2
0
文件: Form1.cs 项目: Azmalent/itmo3
        private void updatePlot()
        {
            var checkedButton = groupBox1.Controls.OfType <RadioButton>().FirstOrDefault(rb => rb.Checked);

            Assert.IsNotNull(checkedButton);
            var equation = problems[checkedButton].Equation;

            double a = (double)aUpDown.Value;
            double b = (double)bUpDown.Value;
            double ya = (double)yaUpDown.Value;
            double yb = (double)ybUpDown.Value;
            double z1 = 0, z2 = 1;
            double precision = (double)precisionUpDown1.Value;

            var solution = ShootingMethod.Solve(equation, a, b, ya, yb, z1, z2, precision);

            drawPlot(solution, a, b);
        }