Beispiel #1
0
        private ISingleValuedSeriesCalculator <int, double, double> DoDI()
        {
            var parameters = new DictionaryParametersProvider(new Dictionary <string, double> {
                { "sigma", sigma }
            });
            var eSeriesParam = new ESeriesParam(parameters);
            var gSeries      = new GSeriesCalculator(parameters);
            var eSeries      = new ESeriesCalculator(gSeries, eSeriesParam, parameters);

            eSeries.SetCacheSize(n);

            return(eSeries);
        }
Beispiel #2
0
        public void TabulateCommand()
        {
            var parameters = new DictionaryParametersProvider(new Dictionary <string, double>
            {
                { "alpha", double.Parse(Alpha) },
                { "beta", double.Parse(Beta) }
            });

            int[] numbsToUse = { 0, 1, 2, 3, 4, 5, 6, 7 };

            var eSeriesParam = new ESeriesParam[numbsToUse.Length];
            var gSeries      = new GSeriesCalculator[numbsToUse.Length];
            var eSeries      = new ESeriesCalculator[numbsToUse.Length];

            for (int i = 0; i < numbsToUse.Length; ++i)
            {
                eSeriesParam[i] = new ESeriesParam(parameters);
                gSeries[i]      = new GSeriesCalculator(parameters);
                eSeries[i]      = new ESeriesCalculator(gSeries[i], eSeriesParam[i], parameters);

                eSeries[i].SetCacheSize(i + 1);
            }

            var x1 = double.Parse(X1);
            var x2 = double.Parse(X2);
            var dx = double.Parse(Dx);

            using (var stream = File.Open("../../output.txt", FileMode.Create))
            {
                using (var writer = new StreamWriter(stream))
                {
                    string header = "X\t" + string.Join("\t", numbsToUse.Select(x => $"E{x}"));
                    writer.WriteLine(header);
                    for (double x = x1; x <= x2; x += dx)
                    {
                        try
                        {
                            string row = $"{x}\t" + string.Join("\t", numbsToUse.Select(i => eSeries[i].Calculate(i, x)));

                            writer.WriteLine(row);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show($"Drawing point failed: {ex.Message}");
                        }
                    }
                }
            }
            MessageBox.Show("Finished output!");
        }