<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>im_oisin (Posts about juggling)</title><link>https://imois.in/</link><description></description><atom:link href="https://imois.in/categories/juggling.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2023 &lt;a href="mailto:hi@imois.in"&gt;Oisin Carroll&lt;/a&gt; </copyright><lastBuildDate>Fri, 22 Dec 2023 00:15:51 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Jack Boyce's Siteswap Questions</title><link>https://imois.in/posts/jack-boyces-siteswap-questions/</link><dc:creator>Oisin Carroll</dc:creator><description>&lt;div id="outline-container-org7e806b5" class="outline-2"&gt;
&lt;h2 id="org7e806b5"&gt;Intro&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org7e806b5"&gt;
&lt;p&gt;
At EJC last year (2018), I came across Jack Boyce's siteswap questions, which
can be found &lt;a href="http://www.juggling.org/help/siteswap/tests/test-boyce.html"&gt;HERE!&lt;/a&gt; I'd highly recommend giving them a go. They start off doable,
and at the end work up to a derivation of how many siteswaps of a given length
there are.
&lt;/p&gt;

&lt;p&gt;
I ended up getting a bit carried away, and writing some programs to visualize
parts of the questions, and take some ideas further. The full source for generating
the graphs can be found &lt;a href="https://github.com/oisincar/siteswap_graph"&gt;on my Github.&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
I wrote almost all of this at the time, but I'm only getting around to cleaning
it up and posting it now… 9 months later.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org392e484" class="outline-2"&gt;
&lt;h2 id="org392e484"&gt;q1&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org392e484"&gt;
&lt;p&gt;
&lt;i&gt;I am juggling \(868671\) with clubs (yeah, right).  How many do I have?&lt;/i&gt;
&lt;/p&gt;

&lt;p&gt;
The number of objects in a given siteswap is just the average value, I.e. The
sum of the numbers divided by the length.
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kr"&gt;let&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt; &lt;span class="ow"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;`&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="p"&gt;`&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Answer: 6
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;


&lt;div id="outline-container-orgd64d8cb" class="outline-2"&gt;
&lt;h2 id="orgd64d8cb"&gt;q2&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgd64d8cb"&gt;
&lt;p&gt;
&lt;i&gt;I have a bowling ball that I can only throw as a site swap '\(3\)' throw. Which&lt;/i&gt;
&lt;i&gt;of the following patterns can I theoretically run, using the bowling ball in addition to 3 normal balls:&lt;/i&gt;
&lt;/p&gt;
&lt;div class="org-center"&gt;
&lt;p&gt;
&lt;i&gt;a) \(53\)     b) \(6631\)    c) \(633\)    d) \(577131\)&lt;/i&gt;
&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
This is a question about orbits. A siteswap throw is thrown it's value number of
beats later (e.g. a \(6\) is thrown 6 beats later). Therefore we're looking for
siteswaps which have a \(3\) every 3 beats (wrapping).
&lt;/p&gt;

&lt;p&gt;
This is only c).
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org85090b2" class="outline-2"&gt;
&lt;h2 id="org85090b2"&gt;q3&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org85090b2"&gt;
&lt;p&gt;
&lt;i&gt;You are doing a 4 ball fountain and decide you want to switch into&lt;/i&gt;
&lt;i&gt;741, an excited state site swap.  You can't just start throwing:&lt;/i&gt;
&lt;i&gt;4444741741… Since the last fountain throw (4) will collide with the&lt;/i&gt;
&lt;i&gt;first 1 you do.  Some connecting throws are needed.  What is the&lt;/i&gt;
&lt;i&gt;shortest starting sequence for 741?&lt;/i&gt;
&lt;/p&gt;

&lt;p&gt;
A 4 ball base fountain occurs in the base state of 4 balls, which can be written
as:
&lt;/p&gt;

&lt;pre class="example" id="orge87ee87"&gt;
4|xxxx
&lt;/pre&gt;

&lt;p&gt;
741 occurs in state:
&lt;/p&gt;
&lt;pre class="example" id="org2fd8b7a"&gt;
7|xx_x__x
4|x_xx_x
1|xxx_x
&lt;/pre&gt;

&lt;p&gt;
Before the 7 is thrown, we're in state &lt;code&gt;xxx_x&lt;/code&gt;, which is simply a \(5\)
away from the base state.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org6636e2f" class="outline-2"&gt;
&lt;h2 id="org6636e2f"&gt;q4&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org6636e2f"&gt;
&lt;p&gt;
&lt;i&gt;You want to get back into the fountain, from 741.  What is the&lt;/i&gt;
&lt;i&gt;shortest connecting (ending) sequence in this direction?&lt;/i&gt;
&lt;/p&gt;

&lt;p&gt;
From &lt;code&gt;xxx_x_&lt;/code&gt; to &lt;code&gt;xxxx___&lt;/code&gt;, we can throw a \(3\).
&lt;/p&gt;

&lt;p&gt;
It's not a coincidence that the the transition into \(741\) (\(5\)) and out (\(3\))
together make a valid siteswap (\(53\)). The intuition here is that you can
transition into any siteswap, repeat that siteswap any number of times, and
transition back. That includes repeating it 0 times. Therefore the transition
into and out of any siteswap must be, itself, a valid (ground state) pattern.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgc61f92e" class="outline-2"&gt;
&lt;h2 id="orgc61f92e"&gt;q5&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgc61f92e"&gt;
&lt;p&gt;
&lt;i&gt;Go from the 4 ball fountain to 714.  What are the shortest&lt;/i&gt;
&lt;i&gt;connecting sequences (both directions)?&lt;/i&gt;
&lt;/p&gt;

&lt;p&gt;
As before we can work out the state that 714 starts in.
&lt;/p&gt;


&lt;pre class="example" id="org25d1178"&gt;
7|x_xx__x
1|xxx__x
4|xx_xx
&lt;/pre&gt;


&lt;p&gt;
Before the 7 is thrown, we're in state \(xx\_xx\). This is where we need our
transition to leave us. We can see it won't be possible to transition in a
single throw, so lets look at transitions of length 2.
&lt;/p&gt;

&lt;p&gt;
I.e. finding the throws a, b here:
&lt;/p&gt;
&lt;pre class="example" id="org9d1dc90"&gt;
4|xxxx
a|
b|xx_xx
&lt;/pre&gt;
&lt;p&gt;
For a and b, (and therefore the transition into the pattern) both \(55\) and \(64\) work.
&lt;/p&gt;

&lt;p&gt;
As for the transition back, a \(2\) works. Without having to check, we know this
will work because \(552\) and \(642\) are valid siteswaps.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;


&lt;div id="outline-container-org10107b7" class="outline-2"&gt;
&lt;h2 id="org10107b7"&gt;q6&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org10107b7"&gt;
&lt;p&gt;
&lt;i&gt;You are already doing \(741\) and want to switch directly into \(714\).&lt;/i&gt;
&lt;i&gt;What is the shortest sequence for doing so?  [You could just&lt;/i&gt;
&lt;i&gt;concatenate the ending sequence found in (4) above and the starting&lt;/i&gt;
&lt;i&gt;sequence in (5), but this is not the shortest solution.]&lt;/i&gt;
&lt;/p&gt;

&lt;p&gt;
Here, we're looking for the transition from \(xxx\_x\) to \(xx\_xx\). This is just a
\(5\).
&lt;/p&gt;

&lt;p&gt;
We can also see this by looking at the transitions we found into the siteswap.
For \(741\) we found \(5\), and for \(714\) we found \(55\). The difference here is just
an extra \(5\).
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org1189a8f" class="outline-2"&gt;
&lt;h2 id="org1189a8f"&gt;q7&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org1189a8f"&gt;
&lt;p&gt;
&lt;i&gt;Is the trick \(66671777161\) simple?  If not, which portion of the&lt;/i&gt;
&lt;i&gt;pattern can be repeated within the larger trick?&lt;/i&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;Is the trick \(6316131\) simple?  If not, which portion can be repeated?&lt;/i&gt;
&lt;/p&gt;


&lt;p&gt;
Here 'simple' (more commonly 'prime') refers to simple cycles in graph theory.
These are siteswaps where each state is only visited once. We could find answers
by working out all the states in each siteswaps, and look for duplicates. If
there's any duplicate, then the siteswap isn't simple, and the throws between
these duplicated states can be repeated. This can be done by brute force as
follows by generating the table by hand. I'm too lazy to do this so I'll write a
much longer program to do it instead… :thinking:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;-- Function mapping from current state to next state.&lt;/span&gt;
&lt;span class="c1"&gt;-- E.g. throw "xxxx___" 5 gives "xxx_x__"&lt;/span&gt;
&lt;span class="nf"&gt;throw&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="kt"&gt;:&lt;/span&gt;&lt;span class="n"&gt;xs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="ow"&gt;=&lt;/span&gt; &lt;span class="n"&gt;before&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="sc"&gt;'x'&lt;/span&gt; &lt;span class="kt"&gt;:&lt;/span&gt; &lt;span class="n"&gt;after&lt;/span&gt;
    &lt;span class="kr"&gt;where&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;before&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;_&lt;/span&gt;&lt;span class="kt"&gt;:&lt;/span&gt;&lt;span class="n"&gt;after&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;=&lt;/span&gt; &lt;span class="n"&gt;splitAt&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;xs&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="s"&gt;"_"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;-- Juggle pattern 100 times, then take the next (length ss) state changes.&lt;/span&gt;
&lt;span class="c1"&gt;-- This creates a list of maps between starting state&lt;/span&gt;
&lt;span class="c1"&gt;-- (say, xxxx___), throw (e.g. 5), and resulting state (xxx_x__)&lt;/span&gt;
&lt;span class="nf"&gt;grEdges&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt; &lt;span class="ow"&gt;=&lt;/span&gt; &lt;span class="n"&gt;take&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;drop&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;scanl&lt;/span&gt; &lt;span class="n"&gt;nextEdge&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;[]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;emptyState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;concat&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="n"&gt;repeat&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="kr"&gt;where&lt;/span&gt; &lt;span class="n"&gt;nextEdge&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;startState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;endState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="ow"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;endState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;endState&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
	&lt;span class="n"&gt;emptyState&lt;/span&gt; &lt;span class="ow"&gt;=&lt;/span&gt; &lt;span class="n"&gt;replicate&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maximum&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="sc"&gt;'_'&lt;/span&gt;

&lt;span class="c1"&gt;-- Print table for a given siteswap&lt;/span&gt;
&lt;span class="nf"&gt;printTable&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt; &lt;span class="ow"&gt;=&lt;/span&gt; &lt;span class="n"&gt;putStrLn&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;unlines&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="n"&gt;showSt&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;grEdges&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="kr"&gt;where&lt;/span&gt; &lt;span class="n"&gt;showSt&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kr"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;show&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="s"&gt;"|"&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then, we can get the tables for both siteswaps we're interested in.
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;printTable&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="n"&gt;digitToInt&lt;/span&gt; &lt;span class="s"&gt;"66671777161"&lt;/span&gt;
&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xxxxx__&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xxxx_x_&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xxx_xx_&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xx_xxx_&lt;/span&gt;
&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;x_xxx_x&lt;/span&gt;
&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xxxx_x_&lt;/span&gt;
&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xxx_x_x&lt;/span&gt;
&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xx_x_xx&lt;/span&gt;
&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;x_x_xxx&lt;/span&gt;
&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xx_xxx_&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;x_xxxx_&lt;/span&gt;

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;printTable&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="n"&gt;digitToInt&lt;/span&gt; &lt;span class="s"&gt;"6316131"&lt;/span&gt;
&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xxx___&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xx___x&lt;/span&gt;
&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;x_x_x_&lt;/span&gt;
&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xx_x__&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;x_x__x&lt;/span&gt;
&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;xx__x_&lt;/span&gt;
&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;x_xx__&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org9a14822" class="outline-3"&gt;
&lt;h3 id="org9a14822"&gt;66671777161&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org9a14822"&gt;
&lt;p&gt;
Here, there are two states that occur more than once. I've marked the pairs here
as a and b. This means you can juggle the patterns between the As (I.e. 6671,
and 7771616), and Bs (717771, and 61666)
&lt;/p&gt;

&lt;pre class="example" id="orge95caf9"&gt;
1| xxxxx__
6| xxxx_x_ A
6| xxx_xx_
6| xx_xxx_ B
7| x_xxx_x
1| xxxx_x_ A
7| xxx_x_x
7| xx_x_xx
7| x_x_xxx
1| xx_xxx_ B
6| x_xxxx_
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org01f74d2" class="outline-3"&gt;
&lt;h3 id="org01f74d2"&gt;6316131&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org01f74d2"&gt;
&lt;p&gt;
Here, this siteswap has no duplicated states, and is therefore prime.
&lt;/p&gt;
&lt;pre class="example" id="org9774560"&gt;
1| xxx___
6| xx___x
3| x_x_x_
1| xx_x__
6| x_x__x
1| xx__x_
3| x_xx__
&lt;/pre&gt;

&lt;p&gt;
We can also use this to make a graph of these patterns. Graphing them using
graphviz. This code prints into pretty much the Dot format used by graphviz, and the
resulting graphs are shown below.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nf"&gt;printGraph&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt; &lt;span class="ow"&gt;=&lt;/span&gt; &lt;span class="n"&gt;putStrLn&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;unlines&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="n"&gt;showSt&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;grEdges&lt;/span&gt; &lt;span class="n"&gt;ss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kr"&gt;where&lt;/span&gt; &lt;span class="n"&gt;showSt&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;startSt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;endSt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"  "&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="n"&gt;startSt&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="s"&gt;" -&amp;gt; "&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="n"&gt;endSt&lt;/span&gt;
	  &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="s"&gt;" [label=&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;show&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;]"&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;



&lt;div id="orgc9235ef" class="figure"&gt;
&lt;p&gt;&lt;img src="https://imois.in/images/siteswap_qs/ss1.png" alt="ss1.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 1: &lt;/span&gt;Siteswap map for 66671777161. We can see the two states we found (labeled A and B) before in the nodes with 2 input and output edges.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
Here we can see the results for our first part, 66671777161. Any closed loop in this is a valid
siteswap, which are (hopefully) just the 4 we found before. Pretty neat!
&lt;/p&gt;


&lt;div id="org0b61a94" class="figure"&gt;
&lt;p&gt;&lt;img src="https://imois.in/images/siteswap_qs/ss2.png" alt="ss2.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 2: &lt;/span&gt;Siteswap map for 6316131&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
As expected, \(6316131\) is prime so the graph is simply a loop with no repeated states.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org0545860" class="outline-2"&gt;
&lt;h2 id="org0545860"&gt;q8&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org0545860"&gt;
&lt;p&gt;
&lt;i&gt;There is 1 ground state 5 ball trick of length 1 (5), 2 of length 2&lt;/i&gt;
&lt;i&gt;(55, 64), 6 of length 3 (555, 564, 645, 663, 744, 753), 24 of length&lt;/i&gt;
&lt;i&gt;4, 120 of length 5, and 720 of length 6.  Clearly the pattern is N =&lt;/i&gt;
&lt;i&gt;L!, which is a big hint that L elements are being permuted.  What L&lt;/i&gt;
&lt;i&gt;things are permuted by ground state site swaps of length L?  (Bear in&lt;/i&gt;
&lt;i&gt;mind that L is not the number of balls.)&lt;/i&gt;
&lt;/p&gt;


&lt;div id="org9b78025" class="figure"&gt;
&lt;p&gt;&lt;img src="https://imois.in/images/siteswap_qs/q8_1.png" alt="q8_1.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 3: &lt;/span&gt;A continuous 5 ball cascade, breaking for a period 4 siteswap, before resuming.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
Looking at siteswaps of length 4, for example. Here, we can assign a, b, c, d to
whatever we want, but we're limited with what we can connect to. The question
becomes: How many ways can we connect up the arrows to form valid patterns.
&lt;/p&gt;

&lt;p&gt;
Any way that we can connect up these, so that every node has 0 or 1 throws going
to it, and the same number of throws leaving it will be a valid pattern.
&lt;/p&gt;

&lt;p&gt;
We can look at each throw in turn, and see what it's possible to connect it to.
a already receives a throw, so it can't be a 0. It can't connect to b, c, d, or
the following 5 because they already have arrows connecting to them.
&lt;/p&gt;


&lt;div id="org9f4efca" class="figure"&gt;
&lt;p&gt;&lt;img src="https://imois.in/images/siteswap_qs/q8_2.png" alt="q8_2.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 4: &lt;/span&gt;There are 4 possible values for a, shown in red.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
Here, in red, are the possible throws from \(a\). \(a \in \{5,6,7,8\}\). It can be seen that b, c, and d,
can also throw to these same 4 positions. However, only one can throw to each.
We need to choose an ordering for these 4 throws to land. The number of ways to
order 4 objects is 4!. By this logic, we can see how it'll be \(l!\) for any number
of throws (until we start getting 0s… See next q).
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org928b085" class="outline-2"&gt;
&lt;h2 id="org928b085"&gt;q9&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org928b085"&gt;
&lt;p&gt;
&lt;i&gt;There are not 7! = 5040 ground state 5 ball patterns of length 7,&lt;/i&gt;
&lt;i&gt;as the above pattern would suggest (the actual number is around&lt;/i&gt;
&lt;i&gt;4300). Why does the pattern break down?  Can you calculate (not by&lt;/i&gt;
&lt;i&gt;brute force!) how many ground state patterns there are for L =&lt;/i&gt;
&lt;i&gt;7,8,9,…?&lt;/i&gt;
&lt;/p&gt;

&lt;p&gt;
This is due to there being 0s in the pattern. As before we can connect these
arrows in any way, but sometimes in later throws we won't have a ball to throw.
&lt;/p&gt;

&lt;p&gt;
Another way of approaching the previous question is to reverse it. Instead of
looking at the throws being made at a point, look instead at the number of
places the throws can come from.
look at the throws landing at a
point. a,b,c,d,e already have their throws chosen, so we're looking at the
subsequent 5 throws. Since we require a ball to land at
each of these times, we can just times together all the ways these arrows could
be directed.
&lt;/p&gt;


&lt;div id="org89820f6" class="figure"&gt;
&lt;p&gt;&lt;img src="https://imois.in/images/siteswap_qs/q9_1.png" alt="q9_1.png"&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
Here, there are a choice of 5 throws that can land at this time. For the
following throw, there are only 4 left, and after is 3 etc. This approach leads
us to the same answer as before: n!.
&lt;/p&gt;

&lt;p&gt;
Where this falls apart however is for longer sequences..
&lt;/p&gt;


&lt;div id="orgc3b14c2" class="figure"&gt;
&lt;p&gt;&lt;img src="https://imois.in/images/siteswap_qs/q9_2.png" alt="q9_2.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 6: &lt;/span&gt;f or g could be a 0, and so the arrows in blue may not be possible. This is the problem with our current method.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
Here, this method falls apart - we don't know if f or g will even 'contain' a
ball for us to throw. Because of this, if we were to continue the previous
method - we'd overestimate the number of siteswaps of any given length.
&lt;/p&gt;

&lt;p&gt;
However, having a 0 in a pattern is pretty much the same as inserting a space
into a shorter siteswap. If we were able to work out the number of siteswaps of
a shorter length with no 0s, and then multiply it by the number of ways we could
'insert' a 0 into that siteswap… We'd be able to work out the number of
siteswaps of any given length despite there being 0s.
&lt;/p&gt;

&lt;p&gt;
Here's an example of this insertion… We can create all siteswaps with 0s
similarly by adding gaps into siteswaps without 0s.
&lt;/p&gt;

&lt;div id="orgd5cafd4" class="figure"&gt;
&lt;p&gt;&lt;img src="https://imois.in/images/siteswap_qs/q9_3.png" alt="q9_3.png"&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;div id="org59a17a8" class="figure"&gt;
&lt;p&gt;&lt;img src="https://imois.in/images/siteswap_qs/q9_4.png" alt="q9_4.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 8: &lt;/span&gt;Siteswap 504 has exactly the same arrow placement as 33, but with an added 0. All siteswaps with 0s have exactly one siteswap without 0s they map to.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
So with this in mind, we can calculate the total number of siteswaps of length
\(L\) by:
&lt;/p&gt;

&lt;div class="org-center"&gt;
&lt;p&gt;
\(\sum_{l=1}^{L}\) (arrow permutations of length \(l\)) \(*\) (ways to insert \(L-l\) gaps into a siteswap of length \(l\))
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org575231c" class="outline-3"&gt;
&lt;h3 id="org575231c"&gt;Arrow permutations:&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org575231c"&gt;
&lt;p&gt;
To work out the permutations of length l, we can use the method we had before.
We go through the catches, and work out where the throw could've come from. Now
that we've no 0s, any unassigned throw before can be used.
&lt;/p&gt;

&lt;p&gt;
The first \(n\), where \(n\) is the number of balls are already determined by the
incoming cascade throws. After that, we have n throws that can land at any
point.
&lt;/p&gt;


&lt;div id="org7b8c8e3" class="figure"&gt;
&lt;p&gt;&lt;img src="https://imois.in/images/siteswap_qs/q9_5.png" alt="q9_5.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 9: &lt;/span&gt;The n (n = 5 here) throws that could arrive at f. After picking the throw to arrive at f, we'll still have n choices for g - since f is now a possible source.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
As long as the pattern is going, we have \(n\) places the throw could've been
made. We go through the siteswap from left to right, picking each throw source
in turn. Therefore, the number of possible sources remains the same - \(n\).
&lt;/p&gt;

&lt;p&gt;
From the previous question, for \(n\) throws following the pattern we have one
less choice each time, totalling \(n!\).
&lt;/p&gt;

&lt;p&gt;
The total number of arrow permutations therefore is
&lt;/p&gt;

&lt;p&gt;
\[ p = \begin{cases}
      l! &amp;amp; l &amp;lt;= n \\
      n! * n^{l-n} &amp;amp; otherwise
   \end{cases}
\]
&lt;/p&gt;

&lt;p&gt;
Since we already know how many ground state siteswaps there are for \(l &amp;lt;= n\),
(I.e. l!) we'll ignore this case for now.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org5c168b2" class="outline-3"&gt;
&lt;h3 id="org5c168b2"&gt;Gap insertion&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org5c168b2"&gt;
&lt;p&gt;
Given a siteswap of length \(l\) with no gaps, we're looking to insert them so as
to end up with one of length \(L, L &amp;gt;= l\).
&lt;/p&gt;

&lt;p&gt;
Another way to phrase this is to say given a sequence of length \(L\), we have to
choose positions for the \(L-l\) gaps. We can't choose
the first \(n\) places though, since the siteswap is ground state.
&lt;/p&gt;

&lt;p&gt;
This is just \({L-n \choose L-l}\), as long as \({ L-n \geq L-l } \implies { l \geq
n }\). There is no way to insert gaps into a siteswap that's shorter than the
number of balls.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org9c90898" class="outline-3"&gt;
&lt;h3 id="org9c90898"&gt;Putting it all together:&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org9c90898"&gt;
&lt;p&gt;
Lets insert what we have into the equation.
&lt;/p&gt;
&lt;div class="org-center"&gt;
&lt;p&gt;
\(\sum_{l=1}^{L}\) (arrow permutations of length \(l\)) \(*\) (ways to insert \(L-l\) gaps into a siteswap of length \(l\))
&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
Since there are 0 ways to insert gaps into siteswaps where \(n &amp;lt; L\), and we already know
from the previous question that the number of siteswaps in this case is \(L!\),
we'll omit this case and come back to it.
&lt;/p&gt;

&lt;p&gt;
\[ s(L, n) = \sum_{l=1}^{L} \bigg[ \begin{cases}
      l! &amp;amp; l &amp;lt;= n \\
      n! * n^{l-n} &amp;amp; otherwise
   \end{cases} * {L \choose l} \bigg] \]
&lt;/p&gt;

&lt;p&gt;
\[ = \sum_{l=n}^{L} \bigg[n! * n^{l-n} * {L-n \choose L-l} \bigg], l \geq n \]
&lt;/p&gt;

&lt;p&gt;
Which gives us the number of ground state siteswaps for a given number of balls (\(n\)) and
length (\(l, l \geq n\))! We can test it to get an answer for how many siteswaps of
length 7 there are:
&lt;/p&gt;

&lt;p&gt;
\[ s(7, 5) = \sum_{l=5}^{7} \bigg[5! * 5^{l-5} * {2 \choose 7-l} \bigg] =
5!(5^0*1 + 5^1*2 + 5^2*1) = 4320 \]
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org7b2d76a" class="outline-3"&gt;
&lt;h3 id="org7b2d76a"&gt;Simplify&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-org7b2d76a"&gt;
&lt;p&gt;
We can simplify this formula a lot further! First taking \(n!\) out side the sum.
&lt;/p&gt;

&lt;p&gt;
\[ = n! * \sum_{l=n}^{L} \bigg[n^{l-n} * {L-n \choose L-l} \bigg] \]
&lt;/p&gt;

&lt;p&gt;
Substitute \(k+n = l\)
\[ = n! * \sum_{k=0}^{L-n} \bigg[n^{k} * {L-n \choose L-k-n} \bigg] \]
&lt;/p&gt;

&lt;p&gt;
Next, substitute \(L-n = d\)
\[ = n! * \sum_{k=0}^{d} \bigg[n^{k} * {d \choose d-k} \bigg] \]
&lt;/p&gt;

&lt;p&gt;
Then we have:
\[ { d \choose d-k } = \frac{d!}{k!(d-k)!} = { d \choose k } \]
&lt;/p&gt;

&lt;p&gt;
\[ \therefore s(l, n) = n! * \sum_{k=0}^{d} \bigg[n^{k} * {d \choose k} \bigg],
l \geq n \]
&lt;/p&gt;

&lt;p&gt;
This can be simplified with the binomial theorem identity, with n = d, a = 1, b
= n.
\[ \sum_{i=0}^{n} {n \choose i} a^{n-i}b^{i} = (a+b)^n \]
&lt;/p&gt;

&lt;p&gt;
\[ \therefore s(L, n) = n! * (n+1)^d \]
&lt;/p&gt;

&lt;p&gt;
And reverting the substitutions
\[ \therefore s(L, n) = n! * (n+1)^{(L-n)} \]
&lt;/p&gt;

&lt;p&gt;
And adding back in the case for l &amp;lt;= n.
\[ \therefore s(L, n) = \begin{cases}
      l! &amp;amp; l &amp;lt;= n \\
      n! * (n+1)^{L-n} &amp;amp; otherwise
   \end{cases} \]
&lt;/p&gt;

&lt;p&gt;
Which… FINALLY gives us the the answer! Phew!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><category>juggling</category><category>math</category><guid>https://imois.in/posts/jack-boyces-siteswap-questions/</guid><pubDate>Mon, 06 May 2019 18:47:08 GMT</pubDate></item></channel></rss>