static void CycloidTiral() { var brach = new Cycloid(4); PlotData p = new PlotData(brach, 0, 4 * Math.PI, .1); p.AddParametricTrial("x", "y", "phi"); p.Graph(); }
static void correlationLengthAnalysis() { List<Series> series = new List<Series>(); //Estimate correlation length var A = new ThreeDIsing(25); //for (double i = 4; i < 5; i += .1) { for (double i = 3; i < 8; i += 1) { Func<double, double> ising = b => { A.SetBeta(i); A.Randomize(); A.Equilibrate(1000000); Debug.Print("Temp: " + i.ToString()); return Math.Log(A.AutoCorrelation((int)b, 50000)); }; series.Add( ising.GetSeriesForGraph(0, 10, 1)); } PlotData data = new PlotData(series.ToArray()); data.Graph(); }
static void QuadraticFrictionProjectileTrial() { //var A = new QuadraticFrictionProjectile(.01, 173, 173); //var ser1 = A.GetDataSeries(0, 11, .05); var A = new QuadraticFrictionProjectile(.01, 200); var theta = A.GetThetaForMaxDistance(); var ser2 = A.GetDataSeries(0, 11, .05, theta); A = new QuadraticFrictionProjectile(.01, 200); theta = A.GetAngleToTarget(155, 90); var ser3 = A.GetDataSeries(0, 11, .05, theta); var data = new PlotData(ser2, ser3); data.AddPoint(155, 90, "target"); data.Graph(); }
static void ProjectileTrial(double gamma) { double v0 = 10; var target = new Tuple<double, double>(5, 2); var p = new PlotData(0, 2, .01); p.AddPoint(target.Item1, target.Item2, "Target to hit"); var projFrict = new LaminarFrictionProjectile(gamma); projFrict.SetvMag(v0); double ang1 = projFrict.GetAngleToTarget(target.Item1, target.Item2); projFrict.SetvMagTheta(v0, ang1); p.SetNewEq(projFrict); p.AddParametricTrial("x", "y", "t", "Launch angle: " + ang1.ToString() + " gamma: " + gamma.ToString()); var projNoFric = new NoFrictionProjectile(); projNoFric.setVmag(v0); var ang2 = projNoFric.GetAnglesToTarget(target.Item1, target.Item2); projNoFric.setTheta(ang2.Item1); p.SetNewEq(projNoFric); p.AddParametricTrial("x", "y", "t", "Launch angle: " + ang2.Item1.ToString() + " gamma: " + gamma.ToString()); p.Graph(); projFrict.GetThetaForMaxDistance(); }
static void PendulumTrial() { var pen = new Pendulum(5, 10, 9.8, .9, .1); PlotData p = new PlotData(pen, 0, 10, .01); p.AddTrial("time", "theta"); p.AddTrial("time", "dTheta"); //p.AddTrial("time", "potentialEnergy"); //p.AddTrial("time", "kineticEnergy"); //p.AddTrial("time", "totalEnergy"); p.Graph(); }
static void LaminarFrictionProjectileTrial() { LaminarFrictionProjectile proj = new LaminarFrictionProjectile(2); proj.SetvMag(10); var target = new Tuple<double, double>(2, .1); var angle = proj.GetAngleToTarget(target.Item1, target.Item2); PlotData p = new PlotData(proj, 0, 2, .01); p.AddPoint(target.Item1, target.Item2, "Target to hit"); if (angle == double.MinValue) throw new Exception("no solution"); proj.SetvMagTheta(10, angle); p.AddParametricTrial("x", "y", "t", "Launch angle: " + angle.ToString()); p.Graph(); }
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(); }