ASPL Manual v 1.00
© 2024 by SetSphere.COM


11-3

   TOSSING DICE SIMULATION

[TOSSING DICE SIMULATION]

WORKSPACE DICERS DESCRIPTION:

Retrying the outcome of a die increases the certainty of the outcome, hence the enthropy also decreases as the certainty increases. The following ASPL variables have been assigned the result of three players throwing a pair of dice on a craptable. p123 is assigned the set results of ggdiceS() for the three players throwing the pair of dice 900 times. t123 the same as p123 except that die1 is retried 5 times to realize a face with 5 dots, and die2 is retried 5 times to realize a face with 3 dots. u123 the same as p123 except that die1 is retried 7 times to realize a face with 5 dots, and die2 is retried 7 times to realize a face with 3 dots.

①  aspl> p123 = ggdiceS(players, player1 player2 player3,throws,900)

②  aspl> t123 = ggdiceS(players, player1 player2 player3,throws,900,die1trials,5 5,die2trials, 3 5)

③  aspl> u123 = ggdiceS(players, player1 player2 player3,throws,900,die1trials,5 7,die2trials,3 7)

Notice that the enthropy of the elements in p123 is the highest, because the simulation was fair as none of the dice is retried.

As the dice are being retried to achieve a certain outcome, the enthropy decreases as the certainty increases.

p123 has elements with enthropy 5.170

t123 has elements with enthropy 3.810

u123 has elements with enthropy 3.004
The checksum of each element is a number that encode the outcome shown on the faces of both dice, regardless of the order. The similarity of p123 such that the elements have the same faces for all three players at a specific throw can be obtained with with sim`fflc

④  aspl> sim`fflc p123

              subset1 vs subset2              similarity
  1     player2(1.p123) | player3(1.p123)     0.05778
  2     player1(1.p123) | player3(1.p123)     0.05889
  3     player1(1.p123) | player2(1.p123)     0.05778

    player2(1.p123) | player3(1.p123) | #######################################    0.05778
    player1(1.p123) | player3(1.p123) | ########################################    0.05889
    player1(1.p123) | player2(1.p123) | #######################################    0.05778

  DONE PROCESSING sim`fflc p123


⑤  aspl> sim`fflc t123

              subset1 vs subset2              similarity
  1     player2(1.t123) | player3(1.t123)     0.16333
  2     player1(1.t123) | player3(1.t123)     0.16556
  3     player1(1.t123) | player2(1.t123)     0.16778

    player2(1.t123) | player3(1.t123) | ######################################    0.16333
    player1(1.t123) | player3(1.t123) | #######################################    0.16556
    player1(1.t123) | player2(1.t123) | ########################################    0.16778

  DONE PROCESSING sim`fflc t123


⑥  aspl> sim`fflc u123

              subset1 vs subset2              similarity
  1     player1(1.u123) | player3(1.u123)     0.29889
  2     player2(1.u123) | player3(1.u123)     0.30444
  3     player2(1.u123) | player1(1.u123)     0.29889

    player1(1.u123) | player3(1.u123) | #######################################    0.29889
    player2(1.u123) | player3(1.u123) | ########################################    0.30444
    player2(1.u123) | player1(1.u123) | #######################################    0.29889

  DONE PROCESSING sim`fflc u123






As the dice are being retried, the three players in the variables p123 t123 and u123 show that they have a higher throws matching outcome. Now we will use the ks command and make sure that the following attributes are set ks faces face1 face2 dicesum chksum enthropy ppdd ffl aelm notice that the mtime attribute is excluded as the element made time is immaterial

Also notice how the three players have a higher throws matching outcome as the dice are being retried: Let's find the specific throws when all three players have the same outcome: this is to find the Union of all elements in the set variable such that the attributes of the elements are matching fU`ks=

To see how ASPL will interpret the command fU`ks=

⑦  aspl> sb fU`ks= p123

  QUOTIENT SET BUILDER

   {fU`ks=  p123} <=>  fU`ks=  p123 

  Detailed view:

   {fU`ks=  p123} <=>

    fU ` ks=  p123 
     | |  |     +-----> set-variable
     | |  +-----------> have the same ksum
     | +--------------> such that
     +----------------> get the elements union


  Set builder syntax is read from left to right, or from bottom to top.
  All ASPL setops are setadic: they take a setop followed by set variables.

  Note that when typing the command: the setop, the stroke, and the quotient
  relation predicates must not include any space.


⑧  aspl> fU`ks= p123
    (shows 2 elements matching)

⑨  aspl> fU`ks= t123
    (shows 43 elements matching)

⑩  aspl> fU`ks= u123
    (shows 133 elements matching)

5.170
3.810
3.004




The ks can set specific attributes of the element, and the sim`fflz will get the similarity of the set variable while matching these attributes. To see the attributes, you can type either attributes or ks

⑪  aspl> attributes

⑫  aspl> ks

⑬  aspl> help ks

⑭  aspl> ks dicesum aelm
    (set the ks vector to attributes: dicesum aelm)

⑮  aspl> sim`fflz p123
    (get the similarity of p123 such that the ks vector is matching)



PARTITION

⑯  aspl> split p123 into p1 p2 p3
    (split p123 into its constituent groups and save them into variables p1 p2 p3)

⑰  aspl> split t123 into t1 t2 t3
    (do the same for t123)

⑱  aspl> split u123 into u1 u2 u3
    (do the same for u123)

⑲  aspl> v
    (view your variables )

     VARIABLES TYPE 1

   vname       |card      |user       |xpC         |Lop    |Lvr               |Lgn                             |Src
   ------------|----------|-----------|------------|-------|------------------|--------------------------------|------------------------------------
   p123        |#2700/3   |(1)root    |ggfunc      |g_     |p123              |player1 player2 player3         |ggdiceS(players, player1 player2 p..
   t123        |#2700/3   |(1)root    |ggfunc      |g_     |t123              |player1 player2 player3         |ggdiceS(players, player1 player2 p..
   u123        |#2700/3   |(1)root    |ggfunc      |g_     |u123              |player1 player2 player3         |ggdiceS(players, player1 player2 p..
   p1          |#900/1    |(1)root    |split       |g_     |p1                |player1                         |split p123
   p2          |#900/1    |(1)root    |split       |g_     |p2                |player2                         |split p123
   p3          |#900/1    |(1)root    |split       |g_     |p3                |player3                         |split p123
   t1          |#900/1    |(1)root    |split       |g_     |t1                |player1                         |split t123
   t2          |#900/1    |(1)root    |split       |g_     |t2                |player2                         |split t123
   t3          |#900/1    |(1)root    |split       |g_     |t3                |player3                         |split t123
   u1          |#900/1    |(1)root    |split       |g_     |u1                |player1                         |split u123
   u2          |#900/1    |(1)root    |split       |g_     |u2                |player2                         |split u123
   u3          |#900/1    |(1)root    |split       |g_     |u3                |player3                         |split u123


the column Lgn shows the group label or labels. In ASPL the group label name is called the landing group name (Lgn), for instance p123 has tree group names: player1 player2 player3

when two variables have a common landing group name, you need to labinate the group labels so that ASPL can distinguish them. Labination is done using the , (comma) by prefixing or suffixing it to the setop:

⑳  aspl> ,fU t1 u1

⑴  aspl> ,fU`c= t1 u1

notice how if you omit the , the group label will overlap and the operation will be performed on the overlapped data

⑵  aspl> fU`c= t1 u1

so labinate setop that will do operation on variables whose group labels are the same; this is important because often variables can be refering to a group name whose elements have changed (eg. a directory on the UNIX system, a JVM in a clustered cloud, a JAR archive, etc.)

to see the partitions of p1 p2 p3 according the the players when they get the same outcome (same checksum):

aspl> fP`c= p1 p2 p3

this is the same as

aspl> fP`c= p123

notice that there is no need to labinate the set operation fP because p1 p2 p3 have different Lgn

looking at the intersection of p1 and p123, labinate the operator by preceding it with a comma

aspl> ,f& p1 p123

looking at the intersection of p1 and p123 such the elements have the same outcome (same checksum)

aspl> ,f&`c= p1 p123

of course t1 is a subset of t123

aspl> subset t1 t123

and t123 is a superset of t1

aspl> superset t123 t1

the density of t1 should be the same as the density of player1 in t123

aspl> density t1 t123

To see the partitions of the elements of p1 t1 u1 according the 'player1' when this player gets the same outcome (same checksum):

aspl> ,fP`c= p1 t1 u1

notice the comma prefixing the fP so that the group label 'player1' is labinated

to print these same outcome:

aspl> ,fU`c= p1 t1 u1
    (get the union of the elements with same checksum, labinate the operator)

get their similarity, consider only these element with same outcome ticking sim with `fflc

aspl> sim`fflc p1 t1 u1

comparing p1 t1 u1 according to ks vector, you may need to get rid of the enthropy, since it is different and will always missmatch:

aspl> ks faces face1 face2 dicesum chksum ppdd ffl aelm

aspl> sim`fflz p1 t1 u1

aspl>  sim`fflc p1 t1 u1

to see these elements where the outcome (checksum) is the same do it >>pairwise<<

aspl> ,fU`c= p1 t1

aspl> ,fU`c= p1 u1

aspl> ,fU`c= t1 u1

when all p1 t1 u1 are issued at once, ASPL fU will look at these p1 t1 u1 when all of them have the common outcome, this means the outcome of the specific throw should be the same for p1 AND for t1 AND for u1

aspl> ,fU`c= p1 t1 u1

regardless of the instance of throw where the outcome is the same

aspl> sim`c p1 t1 u1

aspl> xsim`c p1 t1 u1

to see them, labinate with the comma since all three variables have the same group label or landing group name

aspl> ,cU p1 t1 u1

aspl> ,cU`ks= p1 t1 u1

to see all outcome (checksum) between the players regardless of the when the throw occured, use the cP checksum partition; however there are 21 outcomes for the two dices, and 36 if distinguishing the color of dice which is not the case in here. see the encoding of checksum in the ggdiceS() where order is unimportant. cP is exhaustive because the throws are in the thousands, and three players with 21 outcome. so let's have r123 with 100 throws:

aspl> r123 = ggdiceS(players, player1 player2 player3,throws,100)

aspl> sim`c r123

aspl> cU r123

aspl> cU`ks= r123

aspl> cP r123

aspl> cP`ks~ r123

aspl> cP`ks= r123

aspl> fP r123

to see the players of p123 who get the same face on die1

aspl> ks face1 ppdd ffl aelm

aspl> fU`ks= p123

to see the players of p123 who get the same face on die2

aspl> ks face2 ppdd ffl aelm

aspl> fU`ks= p123

to see the similarity of p123 players having the same face on die2

aspl> sim`fflz p123

to see the similarity of p123 players and t123 players having the same face on die2

aspl> sim`fflz p123 t123

DENSITY you can view the density of the set variable:

aspl> density p123





This example is shown in the following terminal.

       terminal for example: TOSSING DICE SIMULATION
viewme

 -E- Display. 11.3.1   [TOSSING DICE SIMULATION][TOSSING DICE SIMULATION]
Terminal showing TOSSING DICE SIMULATION