Chaotic Motion  1.0
LorenzNew.cs
1 using UnityEngine;
2 using System.Collections;
3 
4 // eqn (54) from http://lsc.amss.ac.cn/~ljh/04LCC.pdf
5 
6 public class LorenzNew : ChaosEqn {
7 
8  private float a, b;
9  private float F = 2.5f; // control parameter
10  private float G = 1.4f; // control parameter
11 
12  public LorenzNew() {
13  name = "LorenzNew";
14 
15  eqnStrings = new string[]{
16  "x = -ax - y^2 - z^2 + aF",
17  "y = -y + xy - bxz + G",
18  "z = -z + bxy + xz"
19  };
20 
21  paramBundles = new ParamBundle[] {
22  // sigma, b, rho
23  new ParamBundle("default (scaled)", new float[]{0.25f, 4f, 2.5f, 1.4f},
24  new Vector3(0.1f, 0.1f, 0.1f), new Vector3(0f, 0f, -25.2f), 0.22f),
25  new ParamBundle("default", new float[]{0.25f, 4f, 1.77f, 1.8f},
26  new Vector3(1f, 1f, 1f)),
27  };
28 
29  paramNames = new string[] { "a", "b", "F", "G"};
30 
31  }
32 
33  public override void SetParams(ParamBundle pb)
34  {
35  a = pb.eqnParam[0];
36  b = pb.eqnParam[1];
37  F = pb.eqnParam[2];
38  G = pb.eqnParam[3];
39  }
40 
41  public override void Function(ref float[] x_in, ref float[] x_out) {
42  x_out[0] = -a*x_in[0] - x_in[1]*x_in[1] - x_in[2]*x_in[2] + a*F;
43  x_out[1] = -x_in[1] + x_in[0]*x_in[1] - b*x_in[0]*x_in[2] + G;
44  x_out[2] = -x_in[2] + b*x_in[0]*x_in[1] + x_in[0]*x_in[2];
45  }
46 
47 }
override void SetParams(ParamBundle pb)
Sets the parameter bunlde to be used by the system.
Definition: LorenzNew.cs:33
float[] eqnParam
parameters used in the equation
Definition: ParamBundle.cs:19
Chaos eqn. Base class for all equations that define a 3D chaotic system.
Definition: ChaosEqn.cs:9
override void Function(ref float[] x_in, ref float[] x_out)
Evaluate the first order evolution of the attractor, given the current position.
Definition: LorenzNew.cs:41
Parameter bundle. Container class to hold the values for starting a chaotic system. Holds the parameters for the equations and the initial position and scale values.
Definition: ParamBundle.cs:13