public QuadraticFrictionProjectile(double beta, double v0Mag)
 {
     AddEqParameter(_g, g);
     AddEqParameter(_beta, beta);
     AddEqParameter(_v0Mag, v0Mag);
     rk = new RungeKutta(updateCoordinates);
 }
        public QuadraticFrictionProjectile(double beta, double vx0, double vy0)
        {
            AddEqParameter(_g, g);
            AddEqParameter(_t, t);
            AddEqParameter(_beta, beta);
            AddDependentVariable(_theta, () => Math.Atan(vy0/vx0));
            AddDependentVariable(_x, () => xOft(this[_t]));
            AddDependentVariable(_y, () => yOft(this[_t]));

            rk = new RungeKutta(updateCoordinates);
            this.CurrentPosAndVelocity = new double[4] { 0, 0, vx0, vy0 };
            SetParameter(_t, 0);
        }
Ejemplo n.º 3
0
        private void InitializeComponent()
        {
            this.redBall = new System.Windows.Forms.PictureBox();
            this.blackBall = new System.Windows.Forms.PictureBox();
            this.anchor = new System.Windows.Forms.PictureBox();
            this.timer1 = new System.Windows.Forms.Timer(new System.ComponentModel.Container());
            this.SuspendLayout();
            this.l = A["l"];
            xOffset = this.Width / 2;
            yOffset = this.Height / 2;
            this.anchor.BackColor = Color.Purple;
            this.anchor.Size = new System.Drawing.Size(3, 3);
            this.anchor.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            anchor.Location = new Point((int)xOffset, (int)yOffset);
            this.redBall.BackColor = Color.Red;
            this.redBall.Name = "picTarget";
            this.redBall.Size = new System.Drawing.Size(5, 5);
            this.redBall.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.redBall.TabIndex = 0;
            this.redBall.TabStop = false;
            this.blackBall.BackColor = Color.Black;
            this.blackBall.Name = "picBall";
            this.blackBall.Size = new System.Drawing.Size(5, 5);
            this.blackBall.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.blackBall.TabIndex = 1;
            this.blackBall.TabStop = false;
            this.timer1.Interval = (int)(1000*h);
            this.timer1.Enabled = true;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.BackColor = System.Drawing.Color.White;
            this.ClientSize = new System.Drawing.Size(392, 341);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                  this.blackBall,
                                                                  this.redBall, this.anchor});
            this.Name = "Form1";
            this.Text = "Crasher";
            this.ResumeLayout(false);
            background = new Bitmap(this.Width, this.Height);
            g = Graphics.FromImage(background);
            B = new RungeKutta(A.updateYVals);
            y = A.initialValues;
        }
Ejemplo n.º 4
0
 public void Evolve(double ti, double tf, double dt)
 {
     double[] yvals = initialValues;
     var series = new RungeKutta().Evaluate(ti, tf, dt, 4, yvals, updateYVals);
     var data = new PlotData(series);
     data.Graph();
 }