tag:blogger.com,1999:blog-58218315884783271462017-06-06T03:50:17.349-07:00XSquaredPlusWhySquaredszymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-5821831588478327146.post-52388992511332938032014-07-10T18:24:00.001-07:002014-07-10T18:24:26.682-07:00Hey, I Have A Blog!I do, I really do, but I haven't really been putting that much on it. The reason was that I have been putting more work into some YouTube videos. Maybe you've heard of some of them, I made them with the help of these two kids, they are named Martin and Cora.<div><br /></div><div>I am now working on two different video games. One is a short kind of online game, and the other, which is much in the planning stages, is a sandbox game that has to do with some stuff that's still totally secret, so I am not going to say any more on that matter.</div><div><br /></div><div>The deadline for the sandbox game is whenever I finish it. So that's a bit of a bummer. But deal.</div><div><br /></div><div>There are new things to play with on my website, and a new video game that I made for my friend Nick's birthday.</div><div><br /></div><div>Here are the links: </div><div>Martin and Cora: https://www.youtube.com/user/MartinAndCoraExplain</div><div>My website: www.stylustechnology.com</div><div>Nick's video game: https://sites.google.com/site/stylustechnology/home/secret</div><div><br /></div><div>Have fun, </div><div> -Eli Davies</div>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com1tag:blogger.com,1999:blog-5821831588478327146.post-63403540463081656302014-04-19T08:44:00.001-07:002014-04-19T08:45:07.772-07:00The Game of Life Hello, in the interest of trying everything that I can think of, I have created a platform for developing patterns using the Game of Life rules. This application is available <a href="https://sites.google.com/site/stylustechnology/recent-stuff/cellular-automata" target="_blank">here</a>. Make sure to download the whole folder, and the load.txt file. You can load from text, load from simple images, and save and reload you're work, as well as pause and adjust the speed of animation. Enjoy<br /><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-6FYZPixjJzQ/U1KZz9yqoXI/AAAAAAAAAFM/iITqTVXlrTA/s1600/Screenshot-1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-6FYZPixjJzQ/U1KZz9yqoXI/AAAAAAAAAFM/iITqTVXlrTA/s1600/Screenshot-1.jpg" height="279" width="320" /></a></div>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0tag:blogger.com,1999:blog-5821831588478327146.post-91537399675804500192013-08-04T14:57:00.002-07:002013-08-04T14:57:50.273-07:00Just For Fun... So I put together this little demo, and this is a good one to take the trouble to download because it's fun. Or, at least, I think it's fun. It's based on the same engine as the pile-o-balls simulator, except this one uses springs. Every time you right click, the game generates an new shape for you to drag around, and every time you press the up or down arrow, the stiffness of the springs is raised or lowered.<br /> So take a look, it can't be that bad, right?<br /><a href="https://sites.google.com/site/stylustechnology/recent-stuff/spring-shapes">https://sites.google.com/site/stylustechnology/recent-stuff/spring-shapes</a>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0tag:blogger.com,1999:blog-5821831588478327146.post-76532344375748752812013-07-30T17:51:00.000-07:002013-08-11T05:14:43.176-07:00More on Numerical Integration<br /> So, in a previous post, I talked about the problem with translating differential equations into computer simulations. I did a lot of talking, but I didn't really say much that was useful. Here are four different methods of integrating the newtonian equations of motion, that are used frequently in simulation.<br /><br /><div style="text-align: center;">Explicit Euler</div><div style="text-align: left;"> Explicit Euler integration, according to <i>Physics for Flash Games, Animation, and Simulations</i> an explicit, first order accurate, and very fast integration scheme. Acceleration is calculated each frame in a simulation, but for our purposes, we can treat it as constant, and deal with a simple falling body, therefore</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?a%28t%29%20%3D%20g" />.</div><div style="text-align: left;"> Velocity can be simply integrated as:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?v%28t%29%20%3D%20at" /></div><div style="text-align: left;"> We if we split up each <i>t</i> into time steps, we then have:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?v_%7Bn%20+%201%7D%20%3D%20v%28n%29%20+%20a%28n%29%5CDelta%20t" /></div><div style="text-align: left;"> Going back to my textbook, that means that our position can be given as:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?x_%7Bn%20+%201%7D%20%3D%20x%28n%29%20+%20v%28n%29%5CDelta%20t" /></div><div style="text-align: left;"> This is Euler integration, and it is used by most programmers who don't need enormous accuracy or stability. And it's a good thing they don't, because if they did, they might need to try something new something like...</div><div style="text-align: left;"><br /></div><div style="text-align: center;">Position Verlet</div><div style="text-align: left;"> Position Verlet, usually just verlet, is a way of using not the first, but the second derivative of the acceleration equation to determine the motion of the particle. If we have our acceleration, and current position, we don't even need to look at the velocity, we have all the information we need to move the particle through the equations of motion. WRONG, we don't have all we need, inertia depends on velocity, and for velocity, we need to know where it was before. So, in verlet integration if:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?a%28t%29%20%3D%20g" />,</div><div style="text-align: left;"> then, we skip the velocity:<br /><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?%5Cint%20a%28t%29dt%20%3D%20gt" /></div> and work with the second derivative:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?%5Cint%20%28gt%29dt%20%3D%20%5Cfrac%7Bgt%5E2%7D%7B2%7D" /></div><div style="text-align: left;"> Discretizing this turns out to be tricky, but my book has the answer, and, if you care, an implementation of Verlet Integration can be found here (<a href="https://sites.google.com/site/stylustechnology/recent-stuff/balls">https://sites.google.com/site/stylustechnology/recent-stuff/balls</a>), where it is used to simulate a large pile of balls. Again, my book gives the result:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?x%28n%20+%201%29%20%3D%202x%28n%29%20-%20x%28n%20-%201%29%20+%20a%28n%29%5Ccdot%20%28%5CDelta%20t%29%5E2" /></div><div style="text-align: left;"> Our final scheme is one that I have not yet implemented, but I get the idea.</div><div style="text-align: left;"><br /></div><div style="text-align: center;">Second Order Runge-Kutta Integration</div><div style="text-align: left;"> This is a way of taking a framework that looks a lot like euler integration, and making it more accurate. It takes the values of position and velocity at the beginning and end of a frame, and averages them. This is like taking the time step and halving it doubling the accuracy. It is also known as Improved Euler integration, and you will see that the final position and velocity equations are actually the Explicit Euler equations in disguise.</div><div style="text-align: left;"> First, define the values of position, velocity, and acceleration, at the beginning of the time step:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?p_1%20%3D%20x%28n%29" />, </div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?v_1%20%3D%20v%28n%29" />,</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?a_1%20%3D%20a%28v_1%2C%20p_1%29" /></div><div style="text-align: left;"> Then, recalculate all values at the end of the time step:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?p_2%20%3D%20p_1%20+%20v_1%20%5Ccdot%20%5CDelta%20t" />,</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?v_2%20%3D%20v_1%20+%20a_1%20%5Ccdot%20%5CDelta%20t" />,</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?a_2%20%3D%20a%28p_2%2C%20v_2%29" /></div><div style="text-align: left;"> Finally, use that to calculate velocity, then position:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?x%28n%20+%201%29%20%3D%20x%28n%29+%5Cfrac%7Bv_1%20+%20v_2%7D%7B2%7D%5CDelta%20t" />,</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?v%28n%20+%201%29%20%3D%20v%28n%29+%5Cfrac%7Ba_1%20+%20a_2%7D%7B2%7D%5CDelta%20t" />.</div><div style="text-align: left;"> And there you have it, three numerical integration schemes, I hope I have managed to make this a little easier of a topic. There is also a fourth-order Runge-Kutta which is similar to the one that I have outlined, but that is a lot longer, and I don't feel like writing out all of the equations. Take a look for your self: <a href="http://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods#Common_fourth-order_Runge.E2.80.93Kutta_method">http://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods#Common_fourth-order_Runge.E2.80.93Kutta_method</a>. Or alternatively, write up an animation of your own, using one of these schemes, and when you have, comment with the link, and make sure to include your source code!</div>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0tag:blogger.com,1999:blog-5821831588478327146.post-75315692425174893552013-07-23T10:25:00.000-07:002013-07-23T10:25:32.415-07:00The Jacobs Ladder<div class="separator" style="clear: both; text-align: center;"><a href="http://upload.wikimedia.org/wikipedia/commons/6/6d/Jacobs_Ladder_toy.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="http://upload.wikimedia.org/wikipedia/commons/6/6d/Jacobs_Ladder_toy.JPG" width="150" /></a></div> The Jacobs ladder is the toy where the top block, when rotated in the right direction, initiates a cascade that will travel all the way down the ladder to the bottom. I have had one kicking around our house for forever, I think I may have stolen it from one of my friends. I apologize to them, but they may forgive me when they realize the use to which I have put their toy.<br /> No, I have not made a jacobs ladder simulation, maybe some day, what I have done, with the help of another friend, is figured out exactly what's going on. We even made one, out of duck tape.<br /> So the basic jacobs ladder has six blocks. Each block has ribbons on it's sides. Unless it's a block at the end, then it only has ribbons on one side. This was what we knew going in, along with the guess that the ribbons must go through the center of the blocks in some sort of configuration.<br /> We wanted to be able to express this whole thing as a diagram, and then maybe a mathematical formulation, so that we could describe all of the possible states of a jacobs ladder, and all of the dynamics that turned one state into another.<br /> The first thing we discovered, however, is that there is only one possible state for the Jacob's Ladder, just one. You can rotate and reflect (flip) this state, but you still get the same situation of each block and each ribbon, just upside down and backwards.<br /> So we drew our diagram:<br /><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-nlA7gVkvJTA/Ue628etWaoI/AAAAAAAAAD0/3FdSFiu4ZI8/s1600/DSCN4606.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="http://2.bp.blogspot.com/-nlA7gVkvJTA/Ue628etWaoI/AAAAAAAAAD0/3FdSFiu4ZI8/s320/DSCN4606.JPG" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;"> This is a side-on view of the jacobs ladder, where you can see the splits in the blocks, the purple is the two-strand line, and the green is the one-strand line. With this diagram, it is easy to see that there is a sort of back loop thing, where either the purple or the green will loop back on itself. This is what gives the ladder is's miraculous cascade ability. We then created a mathematical representation, where each side that did not have a ribbon is called a 0, each side with one ribbon is a I, and each side with two ribbons is a II:</div><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-r7ecYQDG_R8/Ue640JeaN_I/AAAAAAAAAEE/uxBtLEAQtTM/s1600/DSCN4607.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="http://1.bp.blogspot.com/-r7ecYQDG_R8/Ue640JeaN_I/AAAAAAAAAEE/uxBtLEAQtTM/s320/DSCN4607.JPG" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;"> From this diagram, you can easily see that in all non-0 blocks, the color on one side is the same as the color on the other. But what about during the cascade, when everything is weird? Well let's see...</div><div class="separator" style="clear: both; text-align: left;"> Just through observation, we can see that this situation breaks the rules of the numerical representation, but, luckily, the graphical representation gives us an easy way to draw this:</div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-Atxy1i8bqNM/Ue658itMv0I/AAAAAAAAAEQ/Jigog0mOPQE/s1600/DSCN4608.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="http://2.bp.blogspot.com/-Atxy1i8bqNM/Ue658itMv0I/AAAAAAAAAEQ/Jigog0mOPQE/s320/DSCN4608.JPG" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;"> So now we know everything we need to know, and all that is left for us to do is to actually make one. I might make a video about this, we'll see...</div> szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0tag:blogger.com,1999:blog-5821831588478327146.post-65560784430916329052013-07-21T17:15:00.000-07:002013-07-21T17:15:22.355-07:00Balls A giant pile of balls, neatly stacked into the hexagonal formation that all circles love to pack themselves into. This has been my goal for today. Not a big goal, but one that has successfully distracted me from working on something harder and more important, like the Marker And Cell simulation that I am probably going to finish (read: begin) around 2020.<br /> So. I have made rigid body ball simulations before, but they used Euler integration, and thus were not very stable. And, to simulate a giant pile of balls, you need stability. So, I had to find a better way. The way I found was Verlet Integration (could you have guessed).<br /> Verlet Integration, the process by which acceleration, position, and position <img src="http://latex.codecogs.com/gif.latex?%5CDelta%20t" /> ago. This is, for some reason that I don't really understand, a really stable way of integrating the equations of motion.<br /> So that was the integration scheme I chose, and the rest of it turned out to be fairly simple: correct the balls positions to account for overlap, fix velocities to preserve impulses (a problem with Verlet as it turns out), and then do it again a few times to approach truly rigid bodies.<br /> So here's the actual demonstration. Warning, it could be stabler, drag around the balls and it might explode. It is also un-optimized, so I could have a lot bigger pile that I do right now, but, work in progress, here it is:<br /><a href="https://sites.google.com/site/stylustechnology/recent-stuff/balls">https://sites.google.com/site/stylustechnology/recent-stuff/balls</a>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0tag:blogger.com,1999:blog-5821831588478327146.post-69348777385553599392013-07-16T18:20:00.000-07:002013-07-16T18:32:01.879-07:00Shaving TimeSo I'm working on a post right now about the Jacobs Ladder, because my friend and I have recently dissected the Jacobs Ladder mathematically. But in the mean time I would like to talk about numerical integration.<br /> What on earth is that? good question. If you know some calculus, you know that the integral has something to do with taking an infinite amount of slices of something and counting up their area. The process of integrating an equation will give you the end result, but not the whole motion. This motion is all of these infinite slices put together.<br /> Unfortunately, computers have a problem with infinity. So do I, so basically everything that you do in simulation can be described as <i>coarse graining. </i>Coarse graining is the process of taking something that's beautifully smooth, and making it all rough and regimented.<br /> Now one type of this that EVERY developer has to do, is temporal course graining. Also known as time stepping, this takes the current value of a temporally evolving function, say x(t), modifies it based on the rate of change (external forces, inertia) which we'll call x'(t) or v(t), then it waits awhile, then it does it again.<br /> Now we come back to integrals. Say we have the function:<br /><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?x%28t%29%20%3D%20t%5E2" /> (1)</div><div style="text-align: left;"> Now, we, as the creator, can decree that there are no other forces in our world, therefore, integrating this is not that hard:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?%5Cint%20x%28t%29%20dt%20%3D%20%5Cfrac%7Bt%5E%7B3%7D%7D%7B3%7D" /> (2)</div><div style="text-align: left;"> Seems easy right, add a power to the exponent, divide by that new exponent. But what if, after 3 seconds, at t = 3, the base function becomes:</div><div style="text-align: center;"> <img src="http://latex.codecogs.com/gif.latex?x%28t%29%20%3D%20%5Cfrac%7Bt%5E2%7D%7B2%7D" /> (3)</div><div style="text-align: left;"> Easy, right, now our integral is:</div><div style="text-align: center;"><img src="http://latex.codecogs.com/gif.latex?%5Cint%20x%28t%29%20dt%20%3D%20%5Cfrac%7Bt%5E%7B3%7D%7D%7B6%7D" /> (4)</div><div style="text-align: left;"> No problems there, we simply express all solutions to this equations as being (2), for all times less than 3, and (4), for all times greater than three. What's the big deal with that. Well, what if the base function changed after t = 6, and then changed again after t = 9, and kept changing, every time t equalled a multiple of nine?</div><div style="text-align: left;"> Perhaps you can see where I'm going with this, our equation is changing every three seconds, a three second time step.</div><div style="text-align: left;"> To understand the need for this, lets go back to the real world. In the real world, there are no time steps, time just keeps on going, you can't keep looking closer and closer until you find time's framerate, it just doesn't work, it's always smaller than you can look. Sort of like the <i>dt</i> in our equations, in fact, exactly like that. The <i>dt </i>shaves down the variable it's applied to, <i>t</i> in our case, and looks at it through <i>all</i> time. An infinite number of shavings, each with zero width.</div><div style="text-align: left;"> The laws of motion tell us that all objects in a state like to stay in that state, of either motion, or rest, unless another force acts on them. This is fine, but not useful for chaotic simulations, and most simulations used for computer graphics are, because in chaotic simulations there is a lot going on. Things almost never go in a straight line, and the equations determining (not governing: determining), the motion of these particles are always changing.</div><div style="text-align: left;"> Except they're not <i>always</i> changing, they are changing every time step, and teleporting from position to position, based on the computed rates of change for their velocities. The computer looks at things, changes them, waits, and then does it again, each time, it takes off a precisely allotted shaving, not infinitely small, actually rather large, and then does it again, then again, then again, then again.</div><div style="text-align: left;"> It's not that hard to see how this method would produce some errors, things might slip inside of other things, forces might be computed to be too big, or too small, distances might cancel and result in a divide by zero, all of these problems are solvable, but the problem of numerical integration is one that will never go away, because it would take an infinitely powerful computer to have infinitely small timesteps, and that doesn't seem on the horizon.</div><div style="text-align: left;"> This might seem a bit unfortunate for the programmer: he/she will never get a perfect simulation of something, but, for me, it is almost unbearably exciting, I am experimenting with a field of science and technology that will NEVER be done. There will always be room to advance, room to make new methods, new ideas to be tested, and there will always be a better way.</div><div style="text-align: left;"> That sounds like job security to me, thanks for reading. </div>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com1tag:blogger.com,1999:blog-5821831588478327146.post-59470932077005262342013-07-13T15:53:00.000-07:002013-07-13T15:53:13.557-07:00Fire I've spent my day trying to simulate fire. Fire is a hard thing to simulate. It goes every which way, it is hot, it is buoyant, it twirls and spins in free air. It is gone before you've seen it. Each one of these behaviors are things that the simulator has to find solutions to all these problems.<br /> First, there is the fact that everyone knows, namely, fire is hot, and heat rises. Heat rises because it is less dense than air, but the whole idea of Eulerian fluid simulation is to make things the density uniform at all points, that is, to make the fluid incompressible. So how do we account for temperature. I had no idea, so i cribbed the idea from someone else.<br /> The basic method turned out to be to take the density (that's density of smoke or fire, or fog, or whatever, floating around in the fluid), and treat it as the temperature. Once you know that, adding buoyancy is trivial, just introduce an upward force on every point proportional to the density at that point. This gives much better results than my earlier method, that of shooting the fire upwards, as if out of a garden... um flamethrower.<br /> The second problem is that, in most Eulerian, (read <i>Jos</i> <i>Stammian</i>) fluid simulation, the velocity field tends to be smooth, and vortexes tend to disappear almost immediately. This can be solved through grid-based vorticity confinement, which, I discovered is not actually that hard, and has to do with identifying and increasing curvature for all cells.<br /> The only remaining problem is that simple fluid simulations like to diffuse their density, but hate to loose track of it. No color disappears. I had to make it go away manually. A fairly simple coefficient-based decay function solved this problem, and voila, a little bit of fire on my screen.<br /> Here's the first stage of my solver, with, of course, the source code:<br /><a href="https://sites.google.com/site/stylustechnology/recent-stuff/eulerian-fluid-simulation">https://sites.google.com/site/stylustechnology/recent-stuff/eulerian-fluid-simulation</a>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0tag:blogger.com,1999:blog-5821831588478327146.post-81542678916463717882013-07-12T16:52:00.000-07:002013-07-12T16:52:35.863-07:00Hard Math is hard for some. Bach is hard for some. Quantum Mechanics is hard for everyone. Fluid simulation based on the discretization of the Navier-Stokes equations for fluid motion is very very hard.<div> That is, they're hard for me, they might not be hard for others, in fact, I'm sure it isn't. Lots of people have came to understand the theory and practice of fluid simulation, and a lot of them have written papers on it. A lot of them have made videos of their simulations, and posted them on YouTube. But few, very few that I have been able to find, have posted their source code, or specifics on exactly What. To. Do.</div><div><div><div> Let me be clear, this is not a sentiment shared by all programmers, many masters of fluid simulation, including Mr. Grant Kot, as well as Brochu et al. who published their source code along with their paper. Other source code packages are there for the finding, but few are published in a place that is easy to locate.</div></div></div><div> This blog is called X Squared Plus Why Squared, so Why does this happen. The answer seems fairly clear, and resolves into a sort of self-perpetuating cycle, which goes like this:</div><div> A programmer decides to implement a fluid simulator, with little or no prior experience. The more experience with either simulation, programming, or mathematics, the easier it'll be, they work and work and work, research, and research and research, until they finally succeed. They then make a video about it, and post it on YouTube. In the comments section of the video, lots of people ask to see the source codes for this persons simulation, but he is now proud of his work, and does not oblige. He worked hard for what he eventually produced, and is now going to hold on to, and maybe monetize, his creation. This is perfectly understandable, but very unfortunate, because it keeps the magic and awesomeness of fluid simulation in just that realm: that of magic and awe.</div><div> So, what's the answer? This is why I love Processing. Because it is impossible to publish a document with out including the source code. If everyone published a version of their fluid simulator in <a href="http://www.processing.org/">Processing</a>, then this problem would simply go away, the cycle would break, and the internet would suddenly get very, very, very wet.</div>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0tag:blogger.com,1999:blog-5821831588478327146.post-71308067246674899702013-07-10T15:37:00.000-07:002013-07-10T15:37:15.440-07:00Trees<div class="separator" style="clear: both; text-align: center;"></div><div style="margin-left: 1em; margin-right: 1em;"></div><br /><br /> I think that the mathematics of fractal trees has probably been covered by about ten thousand people on the internet, but today, as I sat in the parking lot of the grocery store, with nothing but my notebook and pencil, I had access to the work of exactly <img src="http://latex.codecogs.com/gif.latex?x%5E0%20-%201" /> of them. So I had a go.<div> It's really not that hard, as it turns out. The number of points in a single level of an exponential tree is <img src="http://latex.codecogs.com/gif.latex?x%5En" />, and from there, it's not enormously hard to figure out everything else about the tree. But here was my problem: how to create an algorithm to loop through all elements of an exponential tree. For that, I need to know how many points there are less than a certain index, defined by the parameters n, and i. n is the exponent, and i is the index of the point in that level. For instance, if it was on the 3rd level of a tree with the function <img src="http://latex.codecogs.com/gif.latex?2%5En" />, and an index of 3, it would be the third point on the level that contained 8 total points.</div><div> After a little bit of messing around, but still before dad got back with the groceries, I realized that I could add up the values of all the levels before n, and add i - 1, and get the number of points less than i:</div><div style="text-align: center;"><a href="http://latex.codecogs.com/gif.latex?i%20-%201%20+%20%5Csum_%7Bk%20%3D%20n%20-%201%7D%5E%7Bk_%7Bmax%7D%7D%20x%5Ek" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://latex.codecogs.com/gif.latex?i%20-%201%20+%20%5Csum_%7Bk%20%3D%20n%20-%201%7D%5E%7Bk_%7Bmax%7D%7D%20x%5Ek" /></a></div><div style="text-align: left;">Again, simple stuff.</div><div style="text-align: left;">I don't have a simulation to show you today. =( Maybe tomorrow.</div><div class="separator" style="clear: both; text-align: center;"></div>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0tag:blogger.com,1999:blog-5821831588478327146.post-83395235166428941992013-07-10T03:11:00.000-07:002013-07-10T03:11:13.921-07:00Perhaps<div class="separator" style="clear: both; text-align: center;"></div><div style="margin-left: 1em; margin-right: 1em;"></div><br /><br />So.<br /> The regular person that I show new experimental equations to is not here, or contactable, I wanted to tell someone, so I decided, the world wide web would have to do.<br /> So, the problem is: how to find vortices (read whirlpools) in particle-based fluid simulations. There is a way to format vorticity confinement that involves tracking and introducing by means of a Eulerian grid. I don't like Eulerian grids, so I needed a way to do this without a background mesh.<br /> In smoothed particle hydrodynamics, values around a particle are found by means of kernel functions. I now need a kernel function that can characterize the vorticity around a particle AKA, how much the particles around is are spiraling around it. The real question is: How tangential are the velocities of each particles neighbors relative to that particle.<br /> It's the bell shaped curve. For particle velocities that are 90 degrees away from the direction that would point to the particle that we're looking at, the value would be at the top of the bell. But, for particle velocities that are either moving toward or away from the particle, the value would be low. You could also use this to measure divergence.<br /> So, here's my equation for vorticity:<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://latex.codecogs.com/gif.latex?%5Comega%20_i%20%3D%20%5Csum%20%5Csqrt%7B%5Cfrac%7B1%7D%7B4%5Cpi%20%5Csigma%20%5E2%7D%7D%20e%5E%7B%28%5Cfrac%7B%5Ctheta_k%20-%20%5Cmu%7D%7B2%5Csigma%20%5E2%7D%20%29%7D" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://latex.codecogs.com/gif.latex?%5Comega%20_i%20%3D%20%5Csum%20%5Csqrt%7B%5Cfrac%7B1%7D%7B4%5Cpi%20%5Csigma%20%5E2%7D%7D%20e%5E%7B%28%5Cfrac%7B%5Ctheta_k%20-%20%5Cmu%7D%7B2%5Csigma%20%5E2%7D%20%29%7D" /></a></div> where sigma is adjustable near 1, and<br /><div class="separator" style="clear: both; text-align: center;"><a href="http://latex.codecogs.com/gif.latex?%5Cmu%20%3D%2090%5Eo%20+%5Ctan%5E%7B-1%7D%5Cfrac%7By_i%20-%20y_k%7D%7Bx_i%20-%20x_k%7D" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://latex.codecogs.com/gif.latex?%5Cmu%20%3D%2090%5Eo%20+%5Ctan%5E%7B-1%7D%5Cfrac%7By_i%20-%20y_k%7D%7Bx_i%20-%20x_k%7D" /></a></div><div class="separator" style="clear: both; text-align: left;"> So, maybe that'll work, maybe it won't, we'll see.</div>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0tag:blogger.com,1999:blog-5821831588478327146.post-45925458494902919912013-07-08T14:53:00.000-07:002013-07-08T14:53:42.111-07:00Hunting for Answers<div class="separator" style="clear: both; text-align: center;"></div><div style="margin-left: 1em; margin-right: 1em;"></div><br /><br /> Okay, so some of you have probably seen the movie Good Will Hunting. In that movie, he solves what is purported to be an incredibly difficult math problem. Actually, he solves two problems, but the one we are concerned with here is the second one. It isn't explained in the movie, but we can see that is must have something to do with lines and dots.<br /> All right, so what is the problem. Well, we'll sort out the wording, but it is:<br /> <i>Draw all homeomorphically irreducible trees of size n = 10.</i><br /><i> Homeomorphically</i> <i>irreducible</i> means that it does not have only two lines going to only one dot. A tree, for our purposes, is a map of lines and dots.<br /> So I gave it a try:<br /><div class="separator" style="clear: both; text-align: center;"><a href="https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-ash4/1002287_10201474913456057_804493929_n.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-ash4/1002287_10201474913456057_804493929_n.jpg" width="240" /></a></div><div class="separator" style="clear: both; text-align: left;"> And, it turns out not to be that hard. Try it yourself. Pick another number, other than ten. Try not to look up the answer on Google Images. Post your results.</div><div class="separator" style="clear: both; text-align: left;">Post results.</div><div class="separator" style="clear: both; text-align: left;">Oh, and here's a simulation of a blob: <a href="https://sites.google.com/site/stylustechnology/recent-stuff/blob">https://sites.google.com/site/stylustechnology/recent-stuff/blob</a></div>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0tag:blogger.com,1999:blog-5821831588478327146.post-70819433644397499612013-07-07T16:53:00.001-07:002013-07-07T16:53:56.556-07:00First post and some waterHello, this is my blog<br />I'll put things on it.<br />Here's a fluid simulation:<br /><br /><a href="https://sites.google.com/site/stylustechnology/recent-stuff/smoothed-particle-hydrodynamics">https://sites.google.com/site/stylustechnology/recent-stuff/smoothed-particle-hydrodynamics</a>szymaniumhttp://www.blogger.com/profile/18236772917470145001noreply@blogger.com0