Chaotic Motion  1.0
Aizawa.cs
1 using UnityEngine;
2 using System.Collections;
3 
4 // see http://www.algosome.com/articles/aizawa-attractor-chaos.html
5 // BUT code does not match eqns and z eqn does match http://chaoticatmospheres.com/mathrules-strange-attractors
6 // (which has a typo in the first equation, sheesh)
7 public class Aizawa : ChaosEqn {
8 
9  private float a;
10  private float b;
11  private float c;
12  private float d;
13  private float e;
14  private float f;
15 
16  public Aizawa() {
17  name = "Aizawa";
18 
19  eqnStrings = new string[]{
20  "xdot = (z-b)x - d y",
21  "ydot = d x + (z-b)y",
22  "zdot = c + a z - z^3/3 - (x^2+y^2)(1+ez) + f z x^3 "
23  };
24 
25  paramBundles = new ParamBundle[] {
26  new ParamBundle("default (scaled)", new float[]{0.95f, 0.7f, 0.6f, 3.5f, 0.25f, 0.1f},
27  new Vector3(0.1f, 0f, 0f), new Vector3(00.0f,00.0f,-00.8f), 3.37f),
28  new ParamBundle("default", new float[]{0.95f, 0.7f, 0.6f, 3.5f, 0.25f, 0.1f},
29  new Vector3(0.1f, 0f, 0f)),
30  };
31 
32  paramNames = new string[] { "a", "b", "c", "d", "e", "f"};
33  slideShowSpeed = 1f;
34  }
35 
36  public override void SetParams(ParamBundle pb)
37  {
38  a = pb.eqnParam[0];
39  b = pb.eqnParam[1];
40  c = pb.eqnParam[2];
41  d = pb.eqnParam[3];
42  e = pb.eqnParam[4];
43  f = pb.eqnParam[5];
44  }
45 
46 
47  public override void Function(ref float[] x_in, ref float[] x_out) {
48 
49  x_out[0] = (x_in[2] - b) * x_in[0] - d*x_in[1];
50  x_out[1] = d * x_in[0] + (x_in[2] - b) * x_in[1];
51  x_out[2] = c + a*x_in[2]-x_in[2]*x_in[2]*x_in[2]/3f
52  - (x_in[0]*x_in[0] + x_in[1]*x_in[1])*(1+e*x_in[2])
53  + f * x_in[2] * x_in[0]*x_in[0]*x_in[0];
54  }
55 
56 }
float[] eqnParam
parameters used in the equation
Definition: ParamBundle.cs:19
override void Function(ref float[] x_in, ref float[] x_out)
Evaluate the first order evolution of the attractor, given the current position.
Definition: Aizawa.cs:47
Chaos eqn. Base class for all equations that define a 3D chaotic system.
Definition: ChaosEqn.cs:9
override void SetParams(ParamBundle pb)
Sets the parameter bunlde to be used by the system.
Definition: Aizawa.cs:36
Definition: Aizawa.cs:7
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