Exemple #1
0
        private void GenerateSaveFile()
        {
            //here please enter correct path of file you want to generate
            var    lg   = new Laguerre(Degree);
            string path = $@"C:\Users\Vosming\source\repos\Zad1Tablicowaniefunkcji\Ortho.txt";

            //using (FileStream fs = File.Create(path))
            //{
            //    byte[] info = new UTF8Encoding(true).GetBytes("This is some testing text in the file.");
            //    fs.Write(info, 0, info.Length);
            //}
            string[] lines = new string[1];
            lines[0] = Convert.ToString(Orthogonal);
            //string[] lines = new string[steps + 1];
            //lines[0] = $"x;y_myfunction;y_fromLibrary";
            //var dx = (max - min) / steps;
            //var x = min;
            //double y1 = 0;
            //double y2 = 0;
            //for(int i=1;i<steps+1;i++)
            //{
            //    y1 = lg.Polynomial.FunctionValueInPoint(x);
            //    y2 = alglib.laguerrecalculate(degree, x);
            //    lines[i] = $"{x};{y1};{y2}";
            //    x += dx;


            //}
            System.IO.File.WriteAllLines(path, lines);
        }
Exemple #2
0
        private void GenerateOrthogonality()
        {
            double a   = 0.01;
            double b   = 10e4;
            var    lg  = new Laguerre(FirstDegree);
            var    lg2 = new Laguerre(SecondDegree);
            double dx  = (b - a) / (steps - 1);
            double x;
            double integral = 0.0;

            alpha = 0;
            double fx1;

            if (alpha != 0)
            {
                integral = NewtonCotesTrapeziumRule.IntegrateTwoPoint(z => (lg.Polynomial.FunctionValueInPoint(z) * lg2.Polynomial.FunctionValueInPoint(z) * Math.Pow(z, -alpha) * Math.Exp(-z)), 0.0, 100);
            }
            else
            {
                for (int i = 0; i < steps; i++)
                {
                    //x = Convert.ToDouble(i);
                    x   = Convert.ToDouble(i) * dx + a;
                    fx1 = lg.Polynomial.FunctionValueInPoint(x) * lg2.Polynomial.FunctionValueInPoint(x) * (Math.Pow(x, alpha) * Math.Exp(-x));
                    //x += dx;
                    //double fx2 = lg.Polynomial.FunctionValueInPoint(x) * lg2.Polynomial.FunctionValueInPoint(x) * (Math.Pow(x, alpha) * Math.Exp(-x));
                    //integral += 0.5 * dx * (fx1 + fx2);
                    integral += fx1 * dx;
                }
            }

            Orthogonal = integral;
        }
Exemple #3
0
        private void GeneratePrompt()
        {
            var lg = new Laguerre(degree);

            MessageBox.Show(lg.Polynomial.ToString());
            Polmes = lg.Polynomial.ToString();
        }
Exemple #4
0
        private void GenerateChart()
        {
            PlotModel.Series.Clear();
            var lg = new Laguerre(Degree);

            //var lg1 = new Laguerre(FirstDegree);
            //var lg2 = new Laguerre(SecondDegree);
            //AddChart(lg.Polynomial);

            alpha = 0;

            //PlotModel.Series.Add(new FunctionSeries(x=> lg1.Polynomial.FunctionValueInPoint(x)* lg2.Polynomial.FunctionValueInPoint(x), min,max,steps));
            //PlotModel.Series.Add(new FunctionSeries(x => lg1.Polynomial.FunctionValueInPoint(x) * lg2.Polynomial.FunctionValueInPoint(x)*Math.Pow(x,alpha)*Math.Exp(-x), min, max, steps));
            PlotModel.Series.Add(new FunctionSeries(x => alglib.laguerrecalculate(degree, x), min, max, steps));
            PlotModel.InvalidatePlot(true);
        }