7. Mathematics Examples

7.1 A simple Dynamic System

7.2 A simple Markov Chain
 


Mathematics Examples

In this section, we will introduce two mathematics examples packed in the software.
 
 

A simple Dynamic System
 

Let a system be defined by a triplet (x, y, z) which obeys:
 

x (n+1) = ( x (n) + y(n) + z(n) ) Mod 7;

y (n+1) = x ( n );

z (n+1 ) = y ( n) Mod 5;


This is a finite dynamic system. The domains are:
 

x in { 0, 1, 2, 3, 4, 5, 6 };

y in { 0, 1, 2, 3, 4, 5, 6 };

z in { 0, 1, 2, 3, 4 }.


The possible states are 000, 001, . . ., 100, 101, . . . , 775.
 

Assume initially that (x, y, z) is in state (1 0 0), then it will generate the following sequence by a computer simulation:

1 0 0

1 1 0

2 1 1

4 2 1

0 4 2

6 0 4

3 6 0

2 3 1

6 2 3

4 6 2

5 4 1

3 5 4

5 3 0

1 5 3

2 1 0

3 2 1

6 3 2

4 6 3

6 4 1

4 6 4

0 4 1

5 0 4

2 5 0

0 2 0

2 0 2

4 2 0

6 4 2

5 6 4

1 5 1

0 1 0

1 0 1

2 1 0

3 2 1

6 3 2

4 6 3

6 4 1

4 6 4

0 4 1

5 0 4

2 5 0

0 2 0

2 0 2

4 2 0

6 4 2

5 6 4

1 5 1

0 1 0

1 0 1

2 1 0

3 2 1

6 3 2

4 6 3

6 4 1

4 6 4

0 4 1

5 0 4

2 5 0

0 2 0

2 0 2

4 2 0

6 4 2

5 6 4

1 5 1

0 1 0

1 0 1

2 1 0

3 2 1

6 3 2

4 6 3

6 4 1
 

The next row is 4 6 4.

Step 1. Data and Input File;

The data set is {x, y, z}. The input Data file is math1a.txt, which contains the above. The file is in the software.
 
Step 2. Link the data; To generate data from software, click: Data/Link; and enter "math1a.txt".
 
Step 3: Running Click: "10-Average/+ Integer Linear", this click produces the output data file, which will be opened at this point. It looks like this:
 
  4 6 4             384000

0 4 1             384000

5 0 4             384000

2 5 0             384000

0 2 0             384000

2 0 2             384000

4 2 0             384000

6 4 2             384000

5 6 4             384000

1 5 1             384000
 
 

In the output data file, the first line is 4 6 4, 38400. 464 is the next row predicted, and 38400 is the confidence number of 464. The larger the confidence number is, the more reliable the prediction is. This is the correct answer.

The command predicts next 10 rows. In this case, they are all correct.
 


A simple Markov Chain
 

Let a system be defined by ( x, y, z , s, t), which obeys the following rule:
 
 

x (n+1) = ( x (n) + y(n) + z(n) ) Mod 7;

y (n+1) = x ( n );

z (n+1 ) = y ( n) Mod 5; 60%

z (n+1 ) = ( y ( n)+ 1 ) Mod 5; 40%

s (n+1 ) = ( s(n) + 1 ) Mod 5; 60%

s (n+1 ) = ( s(n) + 2 ) Mod 5; 40%

t (n+1 ) = s ( n) Mod 3.


This is a Markov chain. Each state can go to one of 4 different states with the probability: 36%, 24%, 24%, and 16%. The possible domains are:
 
 

x in { 0, 1, 2, 3, 4, 5, 6 };

y in { 0, 1, 2, 3, 4, 5, 6 };

z in { 0, 1, 2, 3, 4 };

s in { 0, 1, 2, 3, 4 };

t in { 0, 1, 2 }.


The possible states are 00000, 00001, . . ., 10000, 10001, . . . , 77553. A computer simulates this Markov chain 20,000 times and the following data is generated:

 
1 0 0 0 0

1 1 0 1 0

2 1 2 3 1

5 2 1 0 0

1 5 3 2 0

2 1 0 4 2

3 2 2 1 1

0 3 3 2 1

6 0 4 4 2

3 6 0 1 1

2 3 1 2 1

6 2 3 3 2

4 6 2 0 0

5 4 1 1 0

3 5 4 2 1

5 3 0 3 2

1 5 4 0 0

3 1 0 2 0

4 3 2 4 2

2 4 3 0 1

2 2 0 1 0

4 2 2 2 1

1 4 2 3 2

0 1 4 4 0

5 0 1 0 1

6 5 0 1 0

4 6 0 3 1

. . .
 

The next configuration generated by the computer is (6 6 1 0 1). Of course, any one out of 4 possibilities are correct. The data set is {x, y, z, s, t}, i.e. five variables. You can complete this problem in a similar way as the last example:


The result is a distribution:

Possibility Confidence*Probability

1 3 0 2 0             443

6 3 2 1 1             139

3 4 0 0 1             405

0 3 4 1 0             500

6 6 1 0 1             4000

6 6 1 1 0             42000

2 5 4 0 1             101

5 1 3 1 1             367

4 2 2 0 1             44

3 0 3 1 1             481

6 5 1 0 1             253

2 4 0 0 1             24000

2 4 1 0 1             12000

0 2 4 1 0             481

4 5 2 0 1             750

2 4 1 1 0             2500

6 2 4 2 0             310

5 6 1 0 1             424

5 3 1 2 0             120

6 6 2 2 0             5000

1 1 0 0 1             101

6 2 0 1 0             44

4 1 3 2 0             291

0 6 1 2 0             215

---------------------------------------------------

Weighted Average

4 5 1 1 0

Highest Probability

6 6 1 1 0             42000

Error of each number

0.33 0.33 0.22 0.22 0.11

The most likely possibility is ( 6, 6, 1, 1, 0). This is very close to the computer-simulated result, ( 6, 6, 1, 0, 1). The probability of the above configuration is roughly:
 

42000/(4000+42000+24000+12000+2500+5000) = 47%.
The confidence of this prediction is 42000.