Juggling Patterns and Programs

0 0

my name is Steve miner first I want to thank the organizers for putting on another great conference well at least so far but it's been good and today I'm going to try to have some fun with juggling patterns and programs the first i'd like to tell a little story about a young boy who loved juggling his father taught him a few tricks and after lots of practice he was ready to perform in front of the crowd so here's some old video this is a little bit fuzzy from 1983 let's take a look very good alright so if your juggler you'd be pretty impressed as a nine-year-old boy I think you already guessed who it is because I slid my slide but that's not me although I do have those shorts but this is anthony gato who even at nine years old was a world-class juggler he traveled the world for next 30 years worked for Cirque de Soleil in Las Vegas and Orlando a few years ago he retired from juggling performing he's now running a concrete business in Orlando but he was a world-class athlete I mean just tremendous skill set a bunch of World Records so that's just a warm-up for what people can do in juggling maybe you may be wondering okay juggling that's cool everyone likes that but how does that connect to closure why are we had a closure conference talking about juggling well I wasn't the first one to make the connection you remember this guy ritchie key back a few years ago had a great talk simple made easy and part of that talk there was just one slide but you mentioned juggling and he said you know this is a problem for us when we talk about mutable state complected time and value intertwining things makes it hard to understand and that complexity makes hard for us to reason about our programs and he used juggling as an example of complexity so I want to give you a metaphor alert so rich was talking about juggling in terms of incidental complexity I'm going to change it I put my own spin on juggling I want to talk about juggling as essential complexity sometimes we want to do difficult things complex things we want to approach something maybe it's just a challenge maybe it's a business reason but things are hard sometimes we want to look I want to look at juggling as an example of something is hard to do but if we look at it deeply maybe we can get some insight into finding some inner simplicity with in that complex task so for me juggling is going to be our main task and see what we can learn from juggling now to help us get started I'm turning to one of the great men from computer science electro engineering background Claude Shannon you may have heard of him he's known as the father of information theory he contributed a lot to digital circuits way back in the 30s in the 40s he worked with Alan Turing for a while in cryptography just made tremendous contributions all across the fields and anticipating digital computers and communications later he spent most of his career with bell labs but later in life use a professor at MIT and he was also a member of their juggling club so as just a really smart guy who enjoyed juggling he decided to write a paper about the called the scientific aspects of juggling you can find it on the web it's I'm not sure when it was published is supposedly written in the 1980s it's in his collected works published in 1993 it may have been out there sooner weird i take a look at some of Shannon's ideas about juggling to try to get some insight into that so Shannon starts with the history of juggling and of course it turns out every talk on juggling that mentions history at all is going to show this graphic from the additional Egyptian wall painting showing people juggling so we know juggling was popular 4,000 years ago and probably it goes back a lot farther than that Shannon didn't mention this but the New Yorker did some research and found that cavemen were juggling so that's that's even farther back so what Claude Shannon was trying to come up with some insights into juggling and he started with a simple form of juggling he called uniform juggling so that's a one throw at a time alternating hands and a constant rhythm so now we can do a little demo suit alright it's a live demo so the basic idea is were just juggling this is a simple three ball cascade you can kind of feel the beat frequency just every every beat for a one ball catch another Bowl and it's alternating hands the height doesn't really matter all right we can go a little bit faster here but it's basically the same idea okay so well thank you thank you so anybody can learn to juggle like that we talked about the constant rhythm you can see some tricks kind of change the rhythm you can see a sink pay to beat as I'm throwing one ball over a little higher we're trying to keep the other one's going okay so that's that's a little bit beyond what he is talking about or if you're like crossing hands that changes the rhythm so so real jugglers go past this uniform juggling but you always come back to that simple pattern so if we do an analysis at the simple level that gives us a good insight will see how how to connect that to all the other juggling tricks okay so i just talked about the three ball cascade that i was demoing there is a simple simple thing is a crossing pattern so odd odd numbers of balls you do in a crossing pattern even number of balls we do half of them in one hand happen in other hand so we're still alternating the throws but the balls kind of live in what we call a fountain pattern and they just stay on their side in the simplest this is kind of the simplest low energy way of juggling this is what you should normally learn so Shannon looked at juggling and came up with Shannon's juggling theorem and in this the the interesting elements or the flight time plus the time the balls in the air the dwell time is how long the ball is actually in your hand bacon time on your hands after you made to throw the hands empty for a fraction of a second and of course the number of balls is what we care about mostly keep that up and H stands for number hands okay so this so this is a this is Shannon's theorem and it really is a nice I don't know simple equation that gives you the essence of juggling okay but it also points to why juggling is hard okay so I'm calling this complex made hard so what we're on do see how many balls can we juggle and it turns out you can't do that much about the dwell time in the vacant time really good juggler can have can have a pretty quick Doyle time but but the main thing if you want to juggle more bowls you have to throw them higher get a a longer flight time which means throwing higher now the flight time actually though because of physics we're dealing with gravity the flight times proportional to the square of the height so as you get more balls in your pattern you're throwing higher and higher so to double your flight time you have to quadruple your the height you're throwing and the problem in juggling of course small errors and compensations it's a coupled system things compound and it gets hard fast so there's a lot of us almost all of us can learn how to juggle three balls five bowls is a pretty good juggler okay so people some confident three ball jugglers might take you know six months of hard practice to get up to five balls when you start getting to seven you're you're really a dedicated ready to be a professional juggler and the world record for sustained juggle is nine although people have done up to 13 balls for a short period so anyway it gets hard fast and that's I mean that I can see why some people think that's a good metaphor for for compania complicated software but there are ways to think about the juggling problem that might bring back a little simplicity so we'll get to that one other little curiosity when I when I first saw Shannon's theorem I was thinking h you know I'm most jugglers have two hands that's that's the usual thing right but of course you know Shannon was thinking beyond me and he said think our juggling troupe the flying Karamazov brothers a lot of fun i don't know if you've ever seen them that lots of there's some videos on the web and i've seen them a couple of times in person they're a great group so of course when you get a group of four jugglers sharing clubs we're scaling each so it's possible you just have to think about your problem there's there are ways to make things work okay so back to the theorem Shannon also gives a good proof of the theorem I don't have time to go through the whole proof but you can you can kind of think about it a little bit think about the experience of bowls right so a ball is either in the hand or it's flying in the air and it does that kind of her hand basis and think of the experience of your hands a hand either has a ball or it's vacant and that's you think about the whole pattern that's a / / ball basis so Shannon just multiplies those out and finds the equivalence because it all happens at the same time and you know he proves it a little more rigorously than I just explained it but still it's a nice simple equation and I think that's very valuable when we're thinking about our software to try to find the ascent essential simplicity that we can look in there and one other thing you might notice that Shannon doesn't talk about physics directly here I mean he has a discussion about why you know flight times are the way they are due to gravity but that doesn't appear in the equation doesn't talk about the weight of the ball it doesn't take into account a wind velocity there's lots of extraneous details that aren't covered here that would matter if you're in those situations but he's coming at it from the experience of a juggler in a kind of a normal juggling context okay and so that's another maybe something valuable you think about when you're designing your software yeah start with the what's essential what's important and don't let your don't be distracted by all these old crazy possibilities I mean we do have to think about edge cases but try to try to get the basics right first so let's let's review of some lessons from Shannon so in his paper he did a historical analysis he thought about what jugglers have done before you talked about some great jugglers in the past I think that's also a valuable lesson for us when we're doing our software we're facing problems a lot of these problems have been faced or similar problems have been faced in the past it really it makes sense to review the literature a bit just get a feel for how other people have solved these problems maybe they didn't have the same technology but yeah you'll maybe get an insight by just looking through history okay so that's kind of informal but a worthwhile endeavor the second point domain understanding okay so Shannon is a brilliant mathematician he could probably walk up to any system and just say okay here's what's important here's all the numbers work but it helps to actually be in the domain know something have some experience of the thing you're trying to model and Shannon was a juggler he you know he had a long history of juggling and and tinkering he even built juggling machines way back when and that's fun you could find those on the web too so he had a domain understanding before he decided to do is his you know deep analysis or you know for us in software it makes sense to understand how the practitioner of remodeling some kind of financial system or or simulating something the real world try to you know get out there experience that directly before you start writing code that might help help you meet the needs of your users or do something that's more realistic now the third item here choosing the right abstraction that's a really hard problem I say I don't have that much to help you choose right abstraction but if you're here yesterday for Eric Norman's talk you know one way to approach that is by starting with a physical metaphor and juggling is a great physical metaphor okay so that's that's part of the reason I'm I like this connection doing something physical you're engaging different parts of your brain okay you kind of you kind of know how things are going to work just by feel and juggling will develop if you practice a little bit of juggling you'll get that feel for where the ball is going you don't actually watch the ball you can just know from your throat you maybe look at the tops of the ball but but the idea of a physical metaphor i think is a really great starting point for approaching software and i'm really curious see how far that goes with eric's work then the final thing is once you come up with this analysis Claude Shannon's theorem really exposes some of the trade-offs when you're when you're juggling from the experience of a juggler all right so we said he chose the right abstraction he found simplicity and he exposed the trade-offs and I think that's a valuable approach for doing our software sometimes we get too caught up in like oh I can get an answer on this path I'm just going to pursue one path I'm just going to make everything work along that path and sometimes we have 200 off to just fill that in and just do this and and we can be to focus on kind of get tunnel vision it's good to explore trade-offs design a system where you can you know turn some knobs later but keep it within the experience of the common user or or the practitioner in the field if you're modeling something that has has like a physical reality try to think about trade-offs within their experience and model that in your software okay I won't turn to another paper this paper a scientific american paper that came out in 95 beacon lubell and they knew Shannon they refer to Shannon but for me this is the earliest reference i could find that had a description of site swap notation and this is a way to describe describing juggling patterns a lot of jugglers you know don't need any of this they don't they have figured this stuff out naturally Anthony gato saw at the beginning he was he just did his own thing he described his tricks he said well let's see over and under thing to high-low thing but he was he was a very top expert and had an intuitive feel a fantastic athlete so he didn't need a lot of formalism to approach juggling but for the rest of us kind of mere mortals it helps sometimes just have some I don't know somebody else who has thought through things and gives us a little recipe description of different tricks and turns out site swap notation is a really nice way to describe juggling patterns so the first part it's just a sequence of whole numbers integers so enclosure for us that would be a vector and these are just simple numbers in juggling notation we use just write all the digits squash together like a string but we know implicitly those are separate throws and the other aspect juggling we start a pattern we just keep the pattern going so enclosure that would be a cycle implicit cycle so we have a finite vector but implicitly we're just going to start over the beginning again and keep juggling so as I mentioned before the three a throwing a 3 is just a simple cross in a three ball pattern similarly like a 5 would just be a higher throw because you want to fit five bowls in the pattern so it's a continuous juggling so every ball froze and then lands five beats later you're caught five beats later then you throw it again so five bowls fit in that seven balls is hard to do but it's the same idea of crossing on the even patterns like a fourth row is coming back to the same hand that throwing high enough so we can alternate hands two balls living flying any champ and then higher numbers go up you know some good good jugglers can do you know six bowls some even more special notation the zero in siteswap stands for an empty hand okay so sometimes just the way the pattern works this hand doesn't do anything on a beat the one pattern is just a quick switch so you know if you you could throw it quickly there and then then we're throw right away so that's a one coming across a 2 is a throw to the same hand it's a short pro and it's so short that most jugglers we'll just do hold and sometimes though they'll do something fancy and fly the ball around just to distract and that's part of showmanship but a to just stays in the same hand and then the next time this hands in a throwie send it over that ball okay so here's this is a graphic board from the Scientific American article and we're showing a timeline to give you another feel for how those throws work so the first throw was a 5 so at time 0 we're throwing the ball high enough so that lands five beats later at time one we're throwing the three e that that will land since it started at time 1 we had three beats lands at time for the third ball throwing it time to one beat it just lands at time three and then at time three that same ball because we threw one now we're going to throw that that same ball goes again okay so looking across the timeline you can see the first ball has the experience throwing five then throw one throws five and then won the second ball though is just going in a three it feels us through every time it's thrown it's a three so it's kind of in its own sub pattern third ball goes 15 which is very similar okay so you can see how you can mix patterns here together if they fit in just right yeah we can juggle the whole thing now not not every combination of integers is going to be a good juggling pattern and we want to talk a little bit about that this is this important point let me come back to that first I want to give credit to the inventors of site swap notation this goes back to 81 I think the first one Paul Klimek but there were a lot of other juggling notations at the time in the 80s jugglers were trying to figure out how can I describe my tricks other people can share it we didn't have YouTube so they didn't have you know an easy way to share videos and see each other's tricks but yeah they would talk about it and these long-winded descriptions about you know fancy tricks where I'm throwing it over this way and then throwing that way we look quick it turns out that's not so precise and the jugglers were doing their tricks okay individual jugglers knew exactly what they were doing but they were trying to communicate to other people and there's a little bit of bragging rights on some of these things like I invented that trick first okay well I've been doing about for 10 years so they get together at conventions like this is like you know people you know I say say I invented you know kanj way back when before we check even knew about the list so they're arguing about their tricks this is a way to succinctly describe your tricks with a pattern and we kind of merged all these different ideas together where several of these inventors have their own notations and their own reasons for doing a notation a certain way but when they got together and after some discussion and argument they settled oh there's some nice mathematical properties to the way siteswap that we we know today so let's get back to the siteswap one nice property is that the number of balls in your pattern is just the average of all the elements in the pattern so we can see the 531 add that up / 3 and you get three okay the 71 okay it's only a two element pattern but the average is is four so that means there's four balls you start juggling 71 you can think about you through that seven up kind of high and now there's a place for another ball to go so that's a natural the natural number of balls is then before then the last pattern is a really complicated one but we'll come back to that that's a five ball pattern that takes a really excellent juggler to do that but okay so this is a necessary condition that the average has to be a whole integer but it's not sufficient okay there's a little there's another thing to think about there are some averages that will still produce collisions and so we're trying to do a uniform juggling pattern we don't want two balls landing at the same time so what does how do we scheduled landing we talked about this a little bit before but the last line in this this is a well this I think that the biggest code part i'm going to show you today so we'll take a minute to look at it but the last line there we're using map indexed plus on the pattern so you think about the time sequence is the the first argument the order in the vector is going to be our time sequence so the landing pattern for a ball is the height of the bowl or the you know the number you're throwing because that's in a land that many beats later plus whatever time you're launching from ok so that's pretty simple if you think about it collisions happen if we have you know two results that that are the same number so we apply reply distinct to the result now there's a mod on the count or the period of our juggling pattern that's just the handle the kind of oddball cases or someone throws one really high it's not then come down right away but it will you know it just works out mathematically it will re-enter the pattern you know mod the number of throws you have so if you do that and we have a distinct result right unique numbers in each place then that's a juggling pattern that's valid insight swamp now there's one other special case that I had to consider and this is just my opinion but if your pattern what about the empty vector is that a valid juggling pattern so I thought about that long and hard okay there's nothing to juggle nothing too I decided meditation is the simplest form of juggling so I will accept that okay I'm not sure all jugglers agree but I think it works for us programmers so of course once we have a predicate it's natural you have to do a speck in work closure so everyone has to show a spec slide at the conscious okay but it works out and my spec here I'm limiting my throws 29 great jugglers can do a little bit higher but it just it's convenient for me okay so I want to come back to another thing that I alluded to earlier about orbits and this is a way to decompose some patterns into sub patterns and we the mathematicians have called those orbits so with that 53 pattern that we saw before and we saw the timeline you can think of that as a 501 pattern composed kind of by superposition with the 030 pattern okay and then these sub patterns are valid juggling patterns you can juggle that and you can think about like how many bowls would be in the well we already said that there are three balls in the 531 pattern that's the average 531 what's the average of 501 okay so that's you know everyone thinks about that and says it's okay add that 6/3 it's too okay there's two balls that are following this 501 pattern and the 03 oh yeah that's that's one ball in that pattern and this is really a nice property and I know it's just kind of one of those beautiful mathematical things and part of the reason siteswap notation is interesting I think is that people you know we're exploring okay i have these different notations they all work they describe juggling but look at this nice nice property we have from from this kind of representation and it's a simple representation it's a little bit of code to pull out these orbits but it's only a page code it's not a lot and and it just it's very pleasing I think for me at least I think mathematicians like this kind of thing so we can extract another pattern i show here is 4 for 13 that's not even like we if you're not a juggler that's not obvious well what is that pattern but you can think about basically there's a four in each hand going up and down and then there's one one ball just going back going a three-one three-one doing a little circle here now i'm not actually good enough to do that juggling especially kind of the night after the party but but that's it that's a nice little pattern and kind of regular jugglers that really are dedicated can do that so you can see there's first of all the 4 for 13 is a three ball pattern okay just take the average and you can see there's one ball in each of those orbits and the last one is more complicated we'll look at that again separately the other advantage for jugglers to doing this kind of orbital decomposition is that they can practice the orbit separately okay so there's an advantage we see there's a software all time you want to decompose pull things apart because then you can understand them as individual things and you can in this case for jugglers you can practice you can get good at doing the 501 you get good at the three that's that's pretty simple then you can put those together okay so you you know thing you know things about these sub patterns and you kind of get a feel for how that fits together in a larger pattern and I think we experienced that in our software too so even though juggling complex there's a hidden simplicity in there or something you can you can pull out and I hope we try to do that with our software so I want to turn this down to doing a little bit of programming so after thinking about these patterns well that's pretty cool not a good enough juggler to do all these patterns but maybe I computer can figure this out I have closure I found you know the quilt library's been spoken about its several of these conferences is the convenient graphics and animation package runs on closure and closure script so I grabbed this is my first quilt program so I made a little package called rastelli named for a famous old juggler and then I made some animations and just for this talk I made a little movie and and put them on the slide so I'm not doing live coding right now but it would work and i'll let you have my software later this is a 453 pattern which is another beautiful pattern four ball pattern and let me run that and you can see the balls running and one nice thing i like about rastelli is showing these orbits it really helps you think about where the balls are going and gives you a better feel if you just see them flying around in space real time it's sometimes hard to pick out the orbits so I just draw a little trace for you okay and then one more example just because I really think this is a beautiful pattern we have three different orbits here the balls are flying around and it just to me that's just kind of almost art yeah I could I can enjoy just watching that I'm glad I don't have that for a screensaver I'd never get anything done excuse me okay and then this is a really interesting pattern too because you know you can see two bowls in this 901 okay that's that's some basically really high arching pattern okay so you can see the high arches and then you can see the low the ones this coming right across okay so they're alternating and going across like that but that knew I could do that okay I can do that orbit so i could imagine working my way up it's not easy this is this would take years to for a good juggler to learn but i could start on it I'd get a feel for it so I can I could pull out pieces and do some of these individual pieces okay let's let's get back to some more ideas about our patterns and what we can do with patterns so first of all there's isomorphic patterns and this is like just kind of obvious but you can repeat a pattern and that's natural and juggling so the three ball cascade if you just keep doing it you can call it 3333 that's all the same pattern right same shape if you rotate instead of doing just 531 you do 315 that's still a valid pattern it's just kind of the mirror because it's an we shifted one so we're starting on different hand but it's the same shape a pattern okay so we call those isomorphic and we know those are valid patterns we've already established that one patterns valid and any of these changes are still valid now how would you make new patterns ok so the mathematicians did some research here and the first way a simple way is add the period to any one element and that creates a new but valid pat ok you know you don't have to think about this has been proven to work so from if you have 33 you can add two to that first because there's two numbers in it so it's a period of two you can add to the first element a 53 is also a valid pack it's a different shape of course but it's valid and it's something you could transition to from the first pattern you can get to the second pattern ok the juggler can add a trick or do something a little different while he's juggling the more general case is what we call swapping sites and that's why the name siteswap comes from the idea I can make a new juggling pattern by taking any two elements I'm going to swap places and do a little bit of math and that math ok so we're swapping two spaces there are certain distance apart the one that I'm bringing forward in time I have to add the distance so if I if I had a three at time two and bring it to time 1 i'm going to add to write because I go from tree move two spaces I'm sorry I'm adding 2 to the 3 and getting five ok so at the bottom we have an example there the first three started at time zero I'm moving that the time too so i'm going to subtract two from that so i go from the 333 pattern to the 531 pattern I know that's valid ok and we already know the degenerate patterns the single number patterns are all valid those are the base juggling patterns just 23 just 24 just five that kind of thing so then we're creating new patterns from those base patterns we already knew and we can keep doing this swapping different elements adding the period you can generate a lot of interesting patterns just from that and we know we can transition from one pattern to other it's kind of like lining up your parameters and just knowing that all these things fit together when we're programming software jugglers have been doing this for a long time okay and the reason this works is because we're guaranteeing the same landing pattern okay so you can see how the math works on that this it's simple math but it's it's kind of one of those insights once you see it you say oh yeah that's easy but it wasn't obvious at first everyone and people had their different notations so they finally said that is mathematically elegant so I want to come back to this slide hey thinking about the 531 so now you have a little bit of coaching you can see the periods in their right to different periods you can see what happens say if you swap the three in the one right so like we're throwing a one at time 2 and we dinner pull that we're going to pull that forward in time so now we have to throw from time one right the ones moving forward would have to throw it to the 3-wood boo back in time we'd have to subtract from that and make it well that's a little different example sorry that anyway we have to switch switch the values there as you rearrange these may be a better example i guess the switching the five in the end the three we showed you can pull the five of the three just change their order subtract one from the five you get a four so now we're throw it from time one we throwing the four but it's still landing at the same time at time five okay you can also see how if you just rearrange the numbers you could have problems you can have collisions so if you throw the five at time zero at lands at time five it's at the second place or the say the third place at time two if you through the three at time two okay that would also land at time five so that would be a collision so that's why 513 is not a valid juggling pattern okay it still averages out right but we have the collision at the landing site ok so the mathematicians thought a lot about the idea of mapping your landing sites and that leads the idea of doing a state transition diagram for juggling the states now are when you expect a ball to land and so it's a vector of bits we're using one for something we expect something to land at you know the first element is x 0 we've been juggling we're in a steady state we expect a bald land at x 0 we expect a bald land at time one at time two that's the standard three ball juggling pattern if you throw a three right the first ball comes out of the pattern you slide everything forward and now you drop a one in the old say you end up getting in the same state so throwing the three is just a steady you stay in the same state if you throw five that that Bulls not going to come down at time three anymore it's coming down at time five so now we leave a hole in the landing pattern so you can see in the diagram if you start from kind of the upper right side on your screen 1100 the three keeps you in the same state you throw down to the five you get to the new state and that's 1 1001 okay and then once you're in any state we can work out all the transitions that are legal and to keep in a juggling pattern and these are all the tricks that you can do from a three ball pattern limiting yourself I only want to throw up to a five so i'll throw 20 25 and now we've considered all this so get a nice state transition diagram here and i want to put this into lou i haven't quite gotten to this but I'm gonna put this in tulum or do a little graph analysis enclosure and then use a state diagram state machine like this to power my juggling simulation so now my my my little rastelli juggler can do is standard pattern that you gave it but then you can say ok show me put on a show here and it knows the valid transitions it can make other throws and you can get really interesting complex patterns just from these very simple rules ok and so I mean I want to just review the site flop features and try to connect that to some of our our software efforts so the first thing is we're starting with a simple data representation then closure programmers all love that and Stu how I mentioned systemic generality well you know jugglers have been doing that for a long time we're using this simple integer notation and it's you know easy to grasp easy to communicate we'll get that also allows for a flexible interpretation so when we're talking about a 3 my free pattern might be a little higher than like a super experience juggler who can do a really quick low 3 but there's still the same basic shape and a 5 for me is relative to my three so it's higher but it's not we're not giving a precise number like how high you're throwing at how fast you throwing it you just want to you know let the the interpreter the juggler do his own thing that also means our programs I can represent juggling the way I want to show juggling and when you saw my little diagrams yeah I was not physically correct on everything i had a little compression in my height so make it fit better on the screen but the timing felt right and it gives you a good sense of how that juggling pattern would work and i think any experience juggler would recognize those patterns and be able to try to recreate them so flexible interpretations another good element to have in our software we talked about you we might be communicating with other systems we're not always in the closure world but you know a simple data reference ation and the flexible interpretation just a little bit of common knowledge just to know like we're in a juggling context here is enough to let somebody else do something with our clever tricks that maybe they had never thought of as i said before sharing jugglers originally started this notation so they could conveniently share talk about what they were doing i think that that works well in our in our programming world to we want to share data sometimes want to share code too but sharing data is really important composition all the closure programmers care about being able to compose their programs we saw in the juggling world we have composition of sub patterns to make one pattern we have these transitions that let us extend juggling routines so we can put things together in different ways and we know they're valid so compositions another kind of motivation you can get from examining juggling we saw the beginning verification that's important idea give me you can give me any pretty much random set of integers I can verify whether that's a juggling pattern I didn't get into it but there's also another theorem that says give me any random sequence of integers I can search through that and find a valid juggling pattern that's that's the more advanced proof but you can imagine just brute force we can go find that that's really interesting result then the last item here is generation so you know we're all really excited about test tech and now spec with being able to generate you know new data from from old data or descriptions of the data and the same thing help jugglers it was I think really exciting when the jugglers said I'm not only describing my current patterns I found a way to describe all the possible patterns you know given three balls now we know how that works and you can expand that to more and that you know that's that's something they discovered after they came up with their notation okay this is not like oh I wonder how could I describe all jumping back it wasn't like that they were juggling they wanted to share and then a few mathematician said we'll wait a second now that we have this pretty much to examine our whole space of juggling in the in the simple uniform juggling of course there's advanced notation for doing multiplex juggling and and other like tricks beyond the uniform pattern but still I mean I get a really good feeling from having the generation capability just at the simple pattern and I think that's a lesson you know we've I think internalized in the closure community but generation really is a valuable property and we want to work hard to examine what happens when we generate new patterns and we use it for testing but we saw the the talk yesterday about music and he says well what if we just let the computer generate some music and that that was really fascinating so there's a whole world to explore here with generation and you know jugglers have been doing this for about 35 years so so we have we have some catching up to do okay i want to give you a few more resources if you're now interested in juggling i don't know maybe you've been juggling you probably already know this but if you want to pursue juggling juggling gorgs a great website the wjf if you're more into the sport of juggling they have what they call combat juggling they where people try to knock each other's clubs down yes competition it's kind of fun to watch I never would have thought of that myself they have joggling which is running and juggling at the same time and they have their own events there where guys these guys are good and it's another it's a sporting activity but it's just a fun kind of hobby Wikipedia is a great source for lots of juggling information all the jugglers and mathematicians contribute to Wikipedia then there's a couple of other sites for people have been doing juggling programs for a long time so I'm really late to this game but I'm going to do my own spin on it and do some closure alright that I want to give you some other math resource if you want to get into the mathematics of juggling somebody wrote a whole book about the mathematics is juggling you can get into group theory and topology lots of sigmas and subscripts I mean you can go to town and math and go look up this book by a record pollster he's at Monash University in Australia he also published a survey article which is a great article i recommend you read that you can read that one for free you don't have to buy the book and the same burkert pollsters done some videos on juggling on the web and he has a great quote here the way I feel when I look at a nice equation the same way I feel when I look at nice juggling pattern okay so that's the mathematician enjoying juggling and I I kind of enjoy his spirit he's a lot of fun if you watch some of his videos another great juggler a math professor at Cornell Alan knutson i hope i pronounced that right he wrote the frequent asked questions summary for sites notation that is on wrecked out juggling been there for a long time over a decade and he has a fantastic video where he goes through all the siteswap possibilities he's an excellent juggler so he can illustrate everything I can't I had to use my software to illustrate some of those patterns but he can do it and so look him up on the web that's still another great video now I like to change gear i think i have a few minutes so i want to just mention neuroscience this is kind of beyond my area of expertise but i just happen to come across this that the neuro scientists are really excited about juggling it turns out i'm stealing some slides here for mark hot who's talking about recent develops in neuroscience and especially about blame brain plasticity so it turns out they've done some experiments where they train people in juggling they had a control group didn't learn a juggling and then another group who didn't know juggling before they learned juggling after a few months they did brain scans before and after and they notice increase in their gray matter in their brains so they could see brains changing due to learning and juggling it turns out is just a good kind of task I mean they fear in theory you would you would see you know changing your brain from learning a foreign language or learning your clay musical instrument but those tasks take longer you can you could teach people juggling at least three ball patterns pretty quickly and they're excited because now they can see changes in the brain and that that kind of study was repeated they got similar results this was even after a week they could see the changes in the brain of people had learned to juggle and they want to explore that this is a great technique now with it with better scanning technology this kind of task to learn and to see the changes in people's brains really exciting for the neuro scientists they also did another follow-up study beyond this with older adults and they see similar results so even yeah we used to think that you know as you got older basically you're just losing brain cells and kind of a slow downhill slide for older folks well the good news is no you can you can learn things you will acquire more gray matter and white matter more get more brain power just by learning new tasks so so old dogs should learn new tricks it's a worthwhile and in in this kind of similar vein just the benefits of juggling for real people there i came across this talk from jennifer slaw she has a series called juggling life where she teaches people to juggle and and reports just anecdotally but you know I kind of believe her because I like juggling but people have improvements in their memory and concentration flexibility patience you know takes a while to learn how the juggle balance and most these are good properties for programmers too so I say you know why not try a little juggling she has a heartwarming story about teaching a homeless girl who was in a shelter how to juggle him you think well that's not really important for you know somebody in a shelter to learn how to juggle but she reports that you know this girl thought juggling was impossible she could never do it and just with a little bit of coaching and mentoring and maybe it helps that somebody you know took time to be with her but yeah the subject was juggling she learned how to juggle and she got a tremendous sense of accomplishment just from learning how to juggle and we hope that might carry over to other parts of someone's life yo if you get a coach and you learn how to do something that seems impossible and then you accomplish that you get a sense that you can go do a lot of other things so anyway I really recommend this video she's a good speaker and kind of fun story so finally I want to just mention Michael motion who's a fantastic juggler and a true artist he uses excellent juggling skills to explore rhythm and dance and music and just he has a great artistic sense so if you lean more towards the art side of things and less towards a math you might like to look him up on the web just some really inspirational videos and he was talking about juggling he said what you learn is how to feel with your eyes and see with your hands and so to me that kind of express is a Zen of juggling and you know if you're a juggler you know that might make sense to you if you haven't juggled you try it you might like to learn something or have a new experience there so to recap juggling has inspired mathematicians like Claude Shannon over the years and I think we can learn a lot from how they approach you know a complex subject like juggling we reviewed the siteswap notation which is which I call a juggling dsl and I tried to make some connections to our experiences software developers from how the jugglers approached their problem of communicating their juggling patterns and then we found some interesting mathematical properties that derived from just having a simple representation then the third thing is I've written a little closure library and that simulates juggling called rastelli so you know closures really useful for a bunch of things so if you still doubt that juggling is relevant to programmers I just want to point out this painting recently appeared on classic programmer paintings I have no idea how it got there but it's just a good timing for my talk so yeah juggling juggling does apply to programmers and I want to thank my beagle he reviewed an earlier version of this talk and finally I just want to say you know juggling is fun and anybody can learn to juggle so let's take a look at my friend here okay thank you very much [Applause]