Friday, July 4, 2008
Here we see a much better defined orbital, in this case a for the most part circular orbit in the particles innermost shell.
To achive this, paticles were made stationary so they did not move. Their rounded cube visual area (see below) was also divided internally into three shell areas as shown below, which in 2 and 3 are spherically calculated to remove squareness of cube from their path.
After the first shell shown in the first picture making more spherical shells does not leave a path all around due to edges being removed, but that is solved by later combining shell 2 and 3, or 1 and 2, depending on how you want to use them.
The loop is made confident going into the other particles inner shell, but not back out again. So it's drawn into its shell to for the most part stay. This way we make a very simple model of an atom with these If..Then.. statements.
'INSTINCTS are described by the following If..Then.. statements.
CnfChange = -1
'Is confident when moving through the three shells into 1.
If Dist1(N, 0) = 3 And Dist1(N, 1) = 0 Then CnfChange = 1
If Dist1(N, 0) = 2 And Dist1(N, 1) = 3 Then CnfChange = 1
If Dist1(N, 0) = 1 And Dist1(N, 1) = 2 Then CnfChange = 1
'Is confident when the second angle moving into shell 1.
If Dist2(N, 0) = 3 And Dist2(N, 1) = 0 Then CnfChange = 1
If Dist2(N, 0) = 2 And Dist2(N, 1) = 3 Then CnfChange = 1
If Dist2(N, 0) = 1 And Dist2(N, 1) = 2 Then CnfChange = 1
'Is confident when following the same shell around for some distance.
If Dist1(N, 0) = 1 And Dist1(N, 1) = 1 Then CnfChange = 1
If Dist2(N, 0) = 1 And Dist2(N, 1) = 1 Then CnfChange = 1
If Dist1(N, 0) = 2 And Dist1(N, 1) = 2 Then CnfChange = 1
If Dist2(N, 0) = 2 And Dist2(N, 1) = 2 Then CnfChange = 1
If Dist1(N, 0) = 3 And Dist1(N, 1) = 3 Then CnfChange = 1
If Dist2(N, 0) = 3 And Dist2(N, 1) = 3 Then CnfChange = 1
'Not confident when both distances are zero, meaning it sees nothing else
If Dist1(N, 0) = 0 And Dist2(N, 0) = 0 Then CnfChange = -1
'Loses Confidence when it is sitting still.
If Abs(XMR(N) - XMF(N)) + Abs(YMR(N) - YMF(N)) + Abs(ZMR(N) - ZMF(N)) = 0 Then CnfChange = -1
'Loses Confidence when hits the Wall, they Bump, or more than 2 neighbors.
If Wall(N) = 1 Or Bump(N) = 1 Or Greater2 = 1 Then CnfChange = -1
We can predict what that should do, and the model did it, which means we're already at a milestone. We have made our first simple atom, of hydrogen!
The next step is a matter of adding repulsion, to what is at the moment all attraction. Adding one more moving particle, to the one already there, has them meeting up then they go off dancing together. Atoms do have electrons that do this, they repel, so that must be added for the model to add more electrons in orbit, which could get interesting after the first two occupy the inner shell leaving the rest to find a less than circular orbit through, for more complex orbital geometries typical of atoms. Are one step at a time,
It uses 26 bits of RAM memory for the Main Memory, 67 megs total, which is not much for program size but be be patient if you save main memory since it's large for a disk file that comes out twice that in size due to how it saves the array. Or try to draw many at a time, since Visual Basic is wasting a great deal of CPU time doing 32 bit divison and more just to shift a bit that can be coded in Assembler to do superfast.
For highest speed possible, you need a MASM32 editor like this free one.
It is what the Intel (or clone) chip communicates in. Not another layer of software in between such as Visual Basic, C++, or others which can speed up development time by making writing and debugging easier. But the program runs slower since you're not directly communicating to the CPU, are going through the VB editor that goes through Windows to get to the CPU.
MASM32 is worth learning, coded for years in it. Easy one to learn. In the above download has a tutorial, data on all the instructions, and plenty of sample code to try out. Makes learning how to code in it, rather easy. In case you're interested in rewriting the Atom3D.frm program Visual Basic reads into Assembler, to see how fast it can go. With no super number crunching math like the physicists use in supercomputers, it should be like having a supercomputer inside our PC, with atoms that at times kinda have a mind all their own but are otherwise amusing. In time, possibly a better way to model some things.
Sunday, June 29, 2008
A particle such as an electron would not be randomly bouncing off the walls or moving in regular straight lines. Be impossible to say for sure where it is, but what it is shaped like can still be mapped out as in Schrödinger's equation by showing where the probability of finding an electron in orbit would be, by drawing dots where it more likely to be at any given moment. From that these drawings are made showing orbital shapes like these.
Xm = Xbot(N) + YMF(N) - YMR(N)
Ym = Ybot(N) + XMF(N) - XMR(N)
Zm = Zbot(N) + ZMF(N) - ZMR(N)
Private Sub FormMemoryAddress(N As Long)
Addr(N) = XMR(N) + (XMF(N) * 2) + (YMR(N) * 4) + (YMF(N) * 8) + (ZMR(N) *
16) + (ZMF(N) * 32) + (Wall(N) * 64) + (At1 * 128) + (At2 * 32768) + (Greater2 *
Wednesday, June 4, 2008
A very fast (computing time) self-learning mechanism is here taught the basic behavior of interacting particles such as atoms or molecules. Running on one of the first GHZ Pentiums, even written in BASIC, the model achieved 22500 moves per second. It was written in Visual Basic VB6 with the source code available by emailing GaryGaulin@aol.com for latest version. May in time include here.
Shown below are 500 constantly moving "Bots" as they are called due to their being most like a robot in the way they navigate their environment, after first being introduced to their virtual 2D World.
There is an invisible wall (shown in Red) that contains them. Hitting the wall sets a bit which is used as part of the Address at which each Memory is stored. Bumping another bot already there, is trying to occupy the same space as something already there. Unless this is detected then applied to its learning it will do this. Therefore this is one of the behaviors that must be self-learned for it to successfully model particles which cannot occupy the same space at the same time.
The behavior is defined by this If..Then.. sentence.
If Wall(N) = 0 And Bump(N) = 0 Then CnfChange = 1 Else CnfChange = -1
When not hitting or bumping another the Bot has a positive confidence which can keep rising until it reaches the max of 3. When it goes down to zero it takes a random guess what to do next, until it finds a solution or gives up after 50 guesses in which case it is stuck and cannot move anywhere.After several
hours of training they began to aggregate into groups that together maintain complex motions that more or less allows them to stay in one place.
What it learns is stored in a 65 megabyte array, with one 8 bit byte of data at each memory location. The memory is addressed by combining the environmental conditions that it can sense into a 26 bit number (hence 65 meg required) with the following code. The lowest Environment bits see other Bots around itself, in a 5x5 cube (except four corner location to make more circular) which each Bot updates its position in, every time it moves to a new location. In this way they see the other Bots that are around them.
'Form unique number corresponding to positions of other Bots seen.
E1(N) = Bot3D(Xm + 0, Ym - 1, Zm)
E2(N) = Bot3D(Xm + 1, Ym - 1, Zm)
E3(N) = Bot3D(Xm + 1, Ym + 0, Zm)
E4(N) = Bot3D(Xm + 1, Ym + 1, Zm)
E5(N) = Bot3D(Xm + 0, Ym + 1, Zm)
E6(N) = Bot3D(Xm - 1, Ym + 1, Zm)
E7(N) = Bot3D(Xm - 1, Ym + 0, Zm)
E8(N) = Bot3D(Xm - 1, Ym - 1, Zm)
E9(N) = Bot3D(Xm + 0, Ym - 2, Zm)
E10(N) = Bot3D(Xm + 1, Ym - 2, Zm)
E11(N) = Bot3D(Xm + 2, Ym - 1, Zm)
E12(N) = Bot3D(Xm + 2, Ym + 0, Zm)
E13(N) = Bot3D(Xm + 2, Ym + 1, Zm)
E14(N) = Bot3D(Xm + 1, Ym + 2, Zm)
E15(N) = Bot3D(Xm + 0, Ym + 2, Zm)
E16(N) = Bot3D(Xm - 1, Ym + 2, Zm)
E17(N) = Bot3D(Xm - 2, Ym + 1, Zm)
E18(N) = Bot3D(Xm - 2, Ym + 0, Zm)
E19(N) = Bot3D(Xm - 2, Ym - 1, Zm)
E20(N) = Bot3D(Xm - 1, Ym - 2, Zm)
'Add the motor direction to the number. Two bits each for X, Y.
E21(N) = LMR(N)
E22(N) = LMF(N)
E23(N) = RMR(N)
E24(N) = RMF(N)
'Add unique experience for Bumping and hitting Wall to memory.
E25(N) = Bump(N)
E26(N) = Wall(N)
All of the above Environment bits are turned into a single Address:
MemAddr(N) = E1(N) + (E2(N) * 2) + (E3(N) * 4) + (E4(N) * 8) + (E5(N) * 16) + (E6(N) * 32) + (E7(N) * 64) + (E8(N) * 128) + (E9(N) * 256) + (E10(N) * 512) + (E11(N) * 1024) + (E12(N) * 2048) + (E13(N) * 4096) + (E14(N) * 8192) + (E15(N) * 16384) + (E16(N) * 32768) + (E17(N) * 65536) + (E18(N) * 131072) + (E19(N) * 262144) + (E20(N) * 524288) + (E21(N) * 1048576) + (E22(N) * 2097152) + (E23(N) * 4194304) + (E24(N) * 8388608) + (E25(N) * 16777216) + (E26(N) * 33554432)
It adds them together, in power of twos, to derive a number from 0 to 67108863 that describes what it is sensing from its Environment.
Since 26 bits is a large number of different experiences, it can take days for it to have seen everything. After that, memory changes as it may find a new strategy used what once didn't work.
There is no mechanism for taking one memory at a time, yet the large number of possible memories gives it an experience that changes over time. It may after long get set in its ways, do the same thing over in an endless loop that keeps the bots in the center not hitting each other or the walls. But otherwise, it achieves an experience over time in the process of new sensory information being presented over a long period of time.
At some point there will be a trained memory that can be saved with a new file name, to be used as a read-only to model that behavior. In this example they only have to not hit walls or each other to demonstrate the most basic behavior of this mechanism. But the If..Then.. shown above can be added to, for other behaviors.
Shown below is an electronic schematic circuit of the bot this (group intelligence) version started from.
This 2D vrsion showed that this self-learning mechanism works well for what can best be described as moving particles. With a large number being possible at a time, 3D is now being attempted to model Atoms. At that level, there are a small number of atoms that need to be simulated for it to form any molecule, wjhich reduces number of behaviors needing to be taught to a small a number as possible. With their being trillions of different kinds of molecules, a memory for each one is not even possible. But having a large number of realistic atoms running at a time.
One bot will represent one electron in the outer shell. The shape/size of the confinment space it is trained in, will reflect the actual radius of each atom. The path that the internal bots take, reflect energy state, valence, spin up or down, etc.. Bond sites bots that appear at the surface, conforming to a behavior that makes them attractive to what is in a condition to bond to it.
Photon or electron bombardment would be bots (already seen is behavior) that travel in a straight line that can be captured in the swirl of a group (atom), raising its energy state by it being present in the moving configuration, to at some point be released which brings atom back to the stable ground state.