Exemple #1
0
        private Math_Collection.LinearAlgebra.Matrices.Matrix CreateSplineMatrix(List <double> hList)
        {
            //Matrix m = new Matrix();
            double[,] splineMatrixValues = new double[pointList.Count, pointList.Count];
            for (int n = 0; n < pointList.Count; n++)
            {
                for (int j = 0; j < pointList.Count; j++)
                {
                    if (j == 0 && n == 0)
                    {
                        splineMatrixValues[n, j] = 1;
                    }
                    else if (n == pointList.Count - 1 && j == pointList.Count - 1)
                    {
                        splineMatrixValues[n, j] = 1;
                    }
                    else if ((n == 0 || j == 0) || (n == pointList.Count - 1 || j == pointList.Count - 1))
                    {
                        splineMatrixValues[n, j] = 0;
                    }
                    else if (j == n)
                    {
                        splineMatrixValues[n + 1, j] = hList[n];
                        splineMatrixValues[n, j + 1] = hList[n];
                        splineMatrixValues[n, j]     = 2 * (hList[n - 1] + hList[n]);
                    }
                }
            }

            string matrix = new Math_Collection.LinearAlgebra.Matrices.Matrix(splineMatrixValues).ToString();

            return(new Math_Collection.LinearAlgebra.Matrices.Matrix(splineMatrixValues));
        }
Exemple #2
0
        private void Plot()
        {
            //Make asynchronous
            List <double> hList = CalculateH();
            List <double> gList = CalculateG(hList);

            Math_Collection.LinearAlgebra.Matrices.Matrix m = CreateSplineMatrix(hList);

            double[] gListAsArray = gList.ToArray();
            LGS      lgs          = new LGS(m, new Math_Collection.LinearAlgebra.Vectors.Vector(gListAsArray));

            //Make asynchronous
            Math_Collection.LinearAlgebra.Vectors.Vector outcome = lgs.Solve(LGS.SolveAlgorithm.Gauß);

            string sOutcome = outcome.ToString();

            List <double> bList = CalculateB(outcome, hList);
            List <double> dList = CalculateD(outcome, hList);

            SolveSplineFunctions(CreateSplineFunctions(bList, outcome, dList));
        }