Exemple #1
0
        public static Matrix RightRectanglesFormula(double start, double end,
                                                    double step, IMovementControlCondition condition)
        {
            var result = new Matrix(new []
            {
                new double[] { 0 },
                new double[] { 0 },
                new double[] { 0 },
                new double[] { 0 }
            });
            var tempVector = new Matrix(new[]
            {
                new double[] { 0 },
                new double[] { 0 },
                new double[] { 0 },
                new double[] { 0 }
            });
            var stepsCount = (end - start) / step;

            for (var i = 1; i < stepsCount + 1; i++)
            {
                tempVector.Clear();
                for (var j = 0; j < result.RowsCount; j++)
                {
                    tempVector[j, 0] = condition.Control[j](start + i * step);
                }

                var different         = end - (start + i * step);
                var fundamentalMatrix = new FundamentalMatrix.FundamentalMatrix(condition.ConstantCoefficientsMatrix, different).GetFundamentalMatrix();
                result += step * fundamentalMatrix * tempVector;
            }

            return(result);
        }
Exemple #2
0
        private List <Matrix> BuildMovementControl(int time1, int time2, IMovementControlCondition condition)
        {
            var result = new List <Matrix> {
                condition.StartVector
            };

            for (var i = time1; i < time2; i++)
            {
                var fundamentalMatrix = new FundamentalMatrix.FundamentalMatrix(condition.ConstantCoefficientsMatrix, 1).GetFundamentalMatrix();
                var current           = fundamentalMatrix * result.Last()
                                        + CalcIntegral(i, i + 1, condition);
                result.Add(current);
            }

            return(result);
        }
Exemple #3
0
 private Matrix CalcIntegral(double time1, double time2, IMovementControlCondition condition)
 {
     return(IntegralCalculator.RightRectanglesFormula(time1, time2, 0.1, condition));
 }
Exemple #4
0
        public void DrawFunction(int time1, int time2, Func <int, int, IMovementControlCondition, List <Matrix> > movementControl, IMovementControlCondition condititon)
        {
            var points = new Queue <Matrix>(movementControl(time1, time2, condititon));
            var mapper = Mappers.Xy <Point>()
                         .X(x => x.X)
                         .Y(x => x.Y);

            var values = new ChartValues <Point>();

            foreach (var point in points)
            {
                values.Add(new Point(point[0, 0], point[2, 0]));
            }

            _cartesianChart.Series = new SeriesCollection(mapper)
            {
                new LineSeries
                {
                    Title  = "Движение",
                    Values = values,
                    Fill   = Brushes.Transparent,
                }
            };
        }