Example #1
0
        public MainPage()
        {
            InitializeComponent();
            var rk = Ode.GearBDF(
                0,                                             // Initial time point
                new Microsoft.Research.Oslo.Vector(0.4, 0.13), //  Initial X vector
                Population);                                   // Right part

            var eds = rk.AppendStep().SolveFromToStep(0, 200, 0.1).ToArray();
            var x1  = eds.Select(p => new Point(p.T, p.X[0])).ToArray();
            var x2  = eds.Select(p => new Point(p.T, p.X[1])).ToArray();

            //Draw 1st population dynamics graph
            linegraph1.Plot(x1.Select(x => x.X).ToArray(), x1.Select(x => x.Y).ToArray());

            //Draw 2nd population dynamics graph
            linegraph2.Plot(x2.Select(x => x.X).ToArray(), x2.Select(x => x.Y).ToArray());

            //Draw phase portrait for system
            Portrait.Plot(x1.Select(x => x.Y).ToArray(), x2.Select(x => x.Y).ToArray());
        }