Example #1
0
 public static IronPythonEngine.Types.Set GeometricSeries(double start, double q, double items)
 {
     var set = new IronPythonEngine.Types.Set(items);
     set.Add(start);
     var current = start;
     for (int i = 0; i < items; i++)
     {
         current *= q;
         set.Add(current);
     }
     return set;
 }
Example #2
0
        public static IronPythonEngine.Types.Set GeometricSeries(double start, double q, double items)
        {
            var set = new IronPythonEngine.Types.Set(items);

            set.Add(start);
            var current = start;

            for (int i = 0; i < items; i++)
            {
                current *= q;
                set.Add(current);
            }
            return(set);
        }
Example #3
0
        public static IronPythonEngine.Types.Set Series(double start, double d, double items)
        {
            var set = new IronPythonEngine.Types.Set();

            set.Add(start);
            var current = start;

            for (int i = 0; i < items; i++)
            {
                current += d;
                set.Add(current);
            }
            return(set);
        }
Example #4
0
 public static IronPythonEngine.Types.Set Load()
 {
     try
     {
         var openFileDialog = new Microsoft.Win32.OpenFileDialog();
         var set            = new IronPythonEngine.Types.Set(10);
         openFileDialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
         if (openFileDialog.ShowDialog() == true)
         {
             using (var stream = System.IO.File.OpenText(openFileDialog.FileName))
             {
                 string line;
                 while ((line = stream.ReadLine()) != null)
                 {
                     var d = Convert.ToDouble(line);
                     set.Add(d);
                 }
             }
             return(set);
         }
     }
     catch (Exception ex)
     {
         MainWindow.ErrorDialog(ex.Message);
     }
     return(new IronPythonEngine.Types.Set(0));
 }
Example #5
0
 public static IronPythonEngine.Types.Set Load()
 {
     try
     {
         var openFileDialog = new Microsoft.Win32.OpenFileDialog();
         var set = new IronPythonEngine.Types.Set(10);
         openFileDialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
         if (openFileDialog.ShowDialog() == true)
         {
             using (var stream = System.IO.File.OpenText(openFileDialog.FileName))
             {
                 string line;
                 while ((line = stream.ReadLine()) != null)
                 {
                     var d = Convert.ToDouble(line);
                     set.Add(d);
                 }
             }
             return set;
         }
     }
     catch (Exception ex)
     {
         MainWindow.ErrorDialog(ex.Message);
     }
     return new IronPythonEngine.Types.Set(0);
 }
Example #6
0
        public static IronPythonEngine.Types.Set QRandomSet(double min, double max, double items)
        {
            var set  = new IronPythonEngine.Types.Set(items);
            var r    = new Sublight.Utilities.QuantumRandomNumberGenerator();
            var imin = Convert.ToInt32(min);
            var imax = Convert.ToInt32(max);

            for (int i = 0; i < items; i++)
            {
                var item = r.Next(imin, imax);
                set.Add(item);
            }
            return(set);
        }
Example #7
0
        public static IronPythonEngine.Types.Set SRandomSet(double min, double max, double items)
        {
            var set  = new IronPythonEngine.Types.Set(items);
            var r    = new Lib.CryptoRNG();
            var imin = Convert.ToInt32(min);
            var imax = Convert.ToInt32(max);

            for (int i = 0; i < items; i++)
            {
                var item = r.Next(imin, imax);
                set.Add(item);
            }
            return(set);
        }
Example #8
0
        public static IronPythonEngine.Types.Set QRandomSet(double min, double max, double items)
        {
            var set = new IronPythonEngine.Types.Set(items);
            var r = new Sublight.Utilities.QuantumRandomNumberGenerator();
            var imin = Convert.ToInt32(min);
            var imax = Convert.ToInt32(max);
            for (int i = 0; i < items; i++)
            {

                var item = r.Next(imin, imax);
                set.Add(item);
            }
            return set;
        }
Example #9
0
        public static IronPythonEngine.Types.Set RandomSet(double min, double max, double items)
        {
            var set = new IronPythonEngine.Types.Set(items);
            Random r = new Random();
            var imin = Convert.ToInt32(min);
            var imax = Convert.ToInt32(max);
            for (int i = 0; i < items; i++)
            {

                var item = r.Next(imin, imax);
                set.Add(item);
            }
            return set;
        }
Example #10
0
 public static IronPythonEngine.Types.Set Series(double start, double d, double items)
 {
     var set = new IronPythonEngine.Types.Set();
     set.Add(start);
     var current = start;
     for (int i=0; i<items; i++)
     {
         current += d;
         set.Add(current);
     }
     return set;
 }