Пример #1
0
        public static void Main(String[] args)
        {
            var n      = args.Length > 0 ? Int32.Parse(args [0]) : 10000;
            var bodies = new NBodySystem();
            var dtdt   = new Vector2d(0.01);

            Console.WriteLine("{0:f9}", bodies.Energy());
            for (var i = 0; i < n; i++)
            {
                bodies.Advance(ref dtdt);
            }
            Console.WriteLine("{0:f9}", bodies.Energy());
        }
Пример #2
0
        public static void Main(string[] args)
        {
            var n = new NBodySystem(100);

            var numSteps = 10000;
            var stepSize = 100;

            for (int i = 0; i < numSteps; i += stepSize)
            {
                Console.WriteLine("Saving step {0}/{1}", i, numSteps);
                n.integrateStep(stepSize);
                n.SaveImage();
            }
        }