Archive for the 'Juggling' Category

Siteswaps in Matlab

August 10, 2006

Siteswaps are a notation used in juggling which consists of a string of numbers which refer to the throw height of each object being thrown. The hands alternate with each number. There are also other requirements in the string of numbers, in that the number of objects required is the sum of the string integers divided by the length – if that is not an integer then it is not a valid siteswap. Also, numbers should not run into each other, i.e. two balls must not land in the same hand at the same time (although there is other notation to describe multiplex throws). Lastly if the integer is even, then the throw is to the same hand, and if it is odd then the throw is made to the other hand.

So in Matlab (a computing package) I decided to write a program which would determine if a siteswap is valid or not. I also wrote another .m file which would generate a list of all of the vectors called mvl.m (modulo vector list) due to the way that the numbers are generated, and check if every row is a valid siteswap. Also, it can filter by number of balls, and the maximum throw height. This is definitely a brute force method and is an example of bad code. For example, a 5 ball siteswap, with length 6 and maximum throw height of 7 takes 6 seconds to show the complete list of valid siteswaps. Also the length of the siteswap is not variable and longer siteswaps increase the size of the big matrix being iterated to the order of (max+1)^length. Therefore it is not feasible to increase the length of the siteswap to anything over 7 or 8. The siteswap code takes into account the zeros that is why the size is (max+1)^length. The filter for the number of balls works quite well, although if it is taken off it may flood the command window leaving the last 1000 or so valid siteswaps. I think it should be possible to generate vectors on the fly and check them on the fly, so that it would take up a lot less memory, I originally intended the program to work this way but my lack of programming experience let me down.

Here is a link to the files, tested under 7.0.1sp1.