public PredPrey() { Function x = (v) => { return(r * v[0] * (1 - v[0] - b * v[0] * v[1])); }; Function y = (v) => { return(-d + b * v[0] * v[1]); }; fv = new FunctionVector(new Function[] { x, y }); }
static void Main(string[] args) { FunctionVector fv = new FunctionVector(3); fv[0] = x => x[0] + x[1] + x[2]; fv[1] = x => x[0] + x[1] * x[2]; fv[2] = x => x[0] * x[1] + x[2]; Vector tmp = fv.Evaluate(new Vector(new double[] { 1, -1, 3 })); Console.WriteLine("tmp = {0}", tmp); double d = fv[0].Invoke(tmp); Console.WriteLine(d); Console.WriteLine("Start Step 1"); //predator prey simulation //(1) single value PredPrey p = new PredPrey(); p.Nsettle = 1000; Vector v0 = new Vector(new double[] { 0.83, 0.55 }); p.Delta = 1.38; p.run1sim(v0, "C:\\Users\\114113597\\Downloads\\outfile.csv"); Console.ReadKey(); Console.WriteLine("Start Step 2"); //(2) produce bifurcation plot data use default values p.runsimDrange(v0, 1.26, 1.4, 1000, "C:\\Users\\114113597\\Downloads\\outfile1.csv"); Console.ReadKey(); Console.WriteLine("Start Step 3"); //(3) produce second bifurcation plot p.R = 3; p.B = 3.5; p.D = 2; v0 = new Vector(new double[] { 0.57, 0.37 }); p.runsimDrange(v0, 0.5, 0.95, 1000, "C:\\Users\\114113597\\Downloads\\outfile2.csv"); Console.ReadKey(); Console.WriteLine("Finished!!"); }