In this last segment, I'm going to talk about something completely different - the use of chaos in music and dance. This dates back to work by Diana Dabby, who was a PhD student of Steven Strogatz at MIT and also a Carnegie-Hall-level concert pianist. The reason I found out about this was because I got Diana's paper to review. Some of you may not know about this, the way you get a paper published in the scientific literature is: you send it in, the editor asks other people who can evaluate your work for a review, and if the reviews are positive, the paper gets in. And, I've reviewed lots and lots of papers over my career, but this was the first and only one that came with a cassette tape. Remember those? Maybe not. Diana's idea was to take a piece of music, and consider it as a pitch sequence - just a sequence of labelled notes. The piece up above is C-E-G-C-E-G and so on and so forth. And then she took a chaotic attractor - didn't matter which one - and she generated a trajectory on that chaotic attractor, with the points spaced the same distance... that the notes were spaced in the original piece. Now, neglect the fact that different notes can be different lengths - we can talk about that on the forum, if you'd like. Then what she did was she took the first point on the trajectory, and she labelled it with the first note in the piece. And then she took the second point in the trajectory, and labelled it with the second note of the piece, and so on and so forth, until she had the pitch sequence wrapped all the way round the chaotic attractor. That established a mapping between the flow of the dynamics and the flow of the musical piece, and she used that mapping to generate variations on that musical piece. Now, if you generate a trajectory from exactly the same initial condition, and you had some sort of device that could recognise which little green square it was and play the appropriate note, you would get back exactly the original piece. But, if you chose some other point on the chaotic attractor, generated a trajectory, and use the mapping to play the notes that that trajectory followed, you'd get a variation. So, let me play you some of these examples. Here's the original piece. [ piano/keyboard plays ] As many of you know, that's the Prelude in C major from the first book of Bach's 'Well-Tempered Clavier'. Now, if Diana wrapped that piece... the pitch sequences in that piece around a chaotic attractor - the Lorenz attractor - and used that mapping to generate a chaotic variation, this is what you'd hear. [ piano/keyboard plays ] Just like a variation is supposed to do, it sounds like the original in some sense, and yet is different. I just love this work, and I talk about it every year in my University of Colorado version of this class. After one of those classes, one of the students - Josh Stuart - came up after class and said: 'I wonder if we could do this for dance, 'that is, instead of music-in music-out, how about dance-in dance-out?' So here's the idea - very much like Diana Dabby's. Imagine that you have 300 dance moves - maybe they are keyframes in an animation or something like that. Or, you've taken a picture of a dancer every tenth of a second. Then you take a trajectory on a chaotic attractor and you evenly space in time - not in space, but in time - you evenly space 300 points around that attractor. Then you generate a tiling of that attractor. Josh used a Voronoi diagram, such that each point is in the centre of one of these cells. Now, you can imagine the original trajectory as it goes around lighting up those cells in sequence. That's called the 'cell itinerary' of these dynamics. So, this might be the first cell, and the second cell, and the third cell, and the fourth cell, and so on and so forth. Then what you do is, you look at the dance, and you take the first dance move, and you put it in the first cell. And then you take the second dance move, and you put it in the second cell, and so on and so forth. And you end up with a mapping that looks like this. And then you use this, much in the same way as Diana Dabby used her scheme. If you started at the exact same initial condition, and generated a trajectory and played the dance moves for every cell it hit, you would get back the original dance piece. But if you start from someplace else on the same attractor, you would get a chaotic variation of that dance. Here's a demonstration of that scheme in action. This is the dance we used as a demonstration case - not as nice as Bach. Here's a chaotic variation of that dance, generated using the Lorenz equations. You can see it looks like the original, in some sense, but it departs from that original. There's nothing special about the Lorenz equations. You can do this with the Rossler equations too and you get similar effects. By the way, the first time I talked about this work at a conference and I showed this demo, a guy piped up from the second row and said it looks like [ ... ] doing the Macarena. Okay, what's going on here? The original trajectory lit up those cells in a certain order. The variation trajectory lights them up in a different order. So, what this ends up doing is taking chunks out of different parts of the dance, and splicing them together in a different order. Here's a demonstration that will make that visible. This is a medley. There's a Macarena... ballet jump... and a kenpo karate kata. And, when I show you a chaotic variation of that medley, you'll be able to see different chunks of the different parts of the dance, pasted together in a different order. There's some Macarena... goes in and out of karate... more Macarena... there's karate. Someplace in here, there's a full copy of the ballet jump. There it is... Anyway, so you get the idea. If we simply take the same dance moves and shuffle them randomly... this is what it looks like. Any continuity you see here is because the animation software is connecting the dots. It's interpolating between the different key frames, but you can see it looks kind of like it's having an epileptic seizure. There's not the same kind of structure in this movement. I've had lots of students playing with this over the years. It doesn't just apply to sequences of movement snapshots, or sequences of musical notes - it also works with words. Here is a chaotic variation on a piece of 'Alice in Wonderland'. Now, as I said, it's taking chunks out of different regions of the dance and sticking them together in a different order. This is something that happens in lots of different kinds of music. It's also been done in dance by a modern choreographer, named Merce Cunningham, who would chunk up a dance into phrases, and throw the 'I Ching' to determine the order in which the dancers would execute those phrases. And, the dancers and the critics and the audiences all hated it, because there are potentially abrupt transitions at the chunk boundaries, and those abrupt transitions arise because the two moves on either side of those chunk boundaries may be very, very far apart in, kind of, bodyspace. You can really see that in this animation. This is it again, the original, before the chaotic variation of a short ballet adagio composed by a colleague of mine. Now what does it look like if we generate a chaotic variation on that. You can see the smooth movement in the... ouch! Ouch! Ouch! So, you can really see the transitions here. This sent us off on a primrose path because I wanted to interpolate - that is, to smooth those gaps - and not just in a way that was faithful to the tendons and the muscles in the body, but also that was faithful to the style of the movement genre. So, what we did was we took a corpus - a whole bunch of examples of a certain kind of dance - and we looked at the individual joints in the body - so, like the wrist and the elbow and the knee - and we built a directed graph to capture how each of those joints moved. Once you do that, you look at the graph for, say the right shoulder, and you look for the shoulder position in the initial state. And then, you look at that same graph, and you look for the shoulder position in the final state. So, getting the shoulder from here to here can be accomplished simply by looking for something like the shortest path through that graph. Now it gets a little bit more complicated than that, because you actually have 44 joints in your body and you have to do that in parallel. And, they all have to be the same path length, because otherwise all the different joints in the body will depart from the initial condition at the right time, but they will all arrive at the final condition at different times - and that doesn't look good. Another thing that made this hard is - the graphs really are a lot more complicated than that one I just showed you. So, here's an interpolation task that we gave this program. Get me from here to here, in a manner that is consistent with the observed movement patterns in a corpus of ballet. Here's what the program produced. So, computer-generated dance, using machine learning techniques, on a ballet corpus. This work didn't just suck me down the primrose path of machine learning, it also got me working with dancers, and that has culminated in a piece that has been performed in a number of cities. My colleague, David Capps, composed a short phrase of dance. My colleague, Jessica Hodgins, from Carnegie Mellon, let us use her motion capture studio to record that motion. This does not just produce a video or a 2-D image, it produces a 3-D model of every joint in David's body and the path through that state-space as he moves. This is the same technology that was used to create Gollum in 'Lord of the Rings' and all of the wonderful people and creatures in the movie 'Avatar'. Once we had this motion, I used Josh's techniques to create six chaotic variations of those sequences. Then, Jessica's group animated them using Maya, and David and I went into the studio in New York and made a dance. It was called 'Con/cantation', and I had absolutely no idea where to put this on my CV, but it was a really fun. I know that many of you have been wondering about the similarities and differences between chaos and complexity - and dance can help us with that. William Forsythe's piece, 'One Flat Thing, reproduced', takes a complex systems approach to dance - although I'm not sure he'd call it that. 'One Flat Thing' was not structured in the classical way - with an omnipotent choreographer telling people where to be, when and what to do - but rather as a series of interactions between agents - cues transmitted from dancer to dancer, each of which invokes a specific chunk of movement. For example... as this guy in the blue pants executes this movement phrase, you see the guy in the yellow shirt waiting for a cue. When he gets that cue - the kick - he executes another specific phrase. Here's one of Forsythe's scores for the piece - time goes from left to right in this score. Each of the horizontal lines in the staff is a particular person, and the green lines are the cues that go back and forth between those people. The key here is that the overall dance emerges from the rules that the dancers - the agents - follow and the interactions that they go through, much like a flock emerges when birds follow a few simple rules. In particular, you can get flocking behaviour if each bird is following four rules: stay close to the guy next to you, but not too close, go in the same direction and don't bump into anything. From a collection of independent bird agents following those rules, a flock emerges. By the way, just a bit of a disclaimer - there is some timing information layered on top of this score, like the fact that all of the people synchronise up at 7.30. So, it's not completely agent-based dance. Definitions of complex systems are very hard - surprisingly so - but this is how I think about it: systems with lots of moving, interacting parts, out of which some larger scale, maybe simpler behaviour emerges - like flocks of birds or schools of fish. There's no bird-conductor who has a full view of the entire sky saying: 'George bird - you go here, and Mary bird, you go there'. Each of the birds is acting independently using his or her own rules, based on his or her small patch of reality. And, out of that, this larger scale structure emerges. This is in contrast to chaos, where complex behaviour - chaotic attractors and population models, chaotic tumbling satellites and all the things we've talked about during this course - arises in very simple systems, simple in the sense that they don't have a lot of moving parts - a lot of state variables. That's how I think about it. But, there's no generally accepted party line for complexity. For chaos, there kind of is. Okay, now I'm going to wrap up. I've given you a brief and whirlwind sampling of nonlinear, and in particular, chaotic dynamics. This is an interesting, vibrant, highly applicable field with tons of good problems to think about and work on - many of them not only fascinating but also fun, like roulette and dance. Among other things, a playful approach is a great way to convey STEM ideas - science, technology, engineering [and] mathematics - to non-STEM people, especially if they're freaked out about STEM disciplines. Playful approaches are also great for engaging STEM people's brains in new and different ways. Don't discount that - especially if you're a teacher. If you want a numerical computation class to wake up, you just talk to them about how differential equations and interpolation play roles in the animation of human motion. I have to say, this has been quite a ride for me. I've talked about this stuff for well over 20 years in a variety of academic and public domains, including a few nursing homes, but this has been completely different. I've missed the human connection - watching the light bulb go off in people's heads, or watching the kind of blank looks when I say something confusing. The forum and the email have helped me with that. I hope they've helped you as well. It was frustrating to give only multiple choice problems, rather than being able to look at the pictures that [were] generated by all of your code and your observations about those pictures. But, I guess that's one of the downsides of having MOOCs - massive open online courses - with thousands of people in them. In spite of all that, it's been really fun, and I hope you've enjoyed it too. I hope you will take other 'Complexity Explorer' courses, and that you will support 'Complexity Explorer', so that we can continue to develop courses that you would like to take in the future. Thanks