Posted by: Александър Макелов | April 13, 2013

## Thought I’d try to write a song

So I sat for 2 hours and here it is, what a spontaneous thing. I recently dreamed that I’d written a song. If it’s the same one, it’d be pretty amazing. Maybe people from the future will have some way of telling that?

Anyway, note that this is my first attempt at poetry/songwriting in English, so it’s pretty lame. Also, it doesn’t feel like something that’s really mine. I’ve no idea whom I’m singing to, I kind of have an idea what I’m singing about, but in the end it didn’t quite came out the way I intended it to; it’s just… something. Chords don’t appear over the corresponding syllables, so use your intuition until I find a way to put whitespace at the beginning of a line in wordpress.

C
Scribbles in the sand, don’t
E
really help me understand,
F
what to make of all these questions,
Fm
so maybe you’d have some suggestions?

C
Me and you, an hour or two,
E
nevermind the ticking, kicking
F
through the door, you know,
Fm
forever’s where we’ll go.

C             E
And I,
F                                Fm
wanna breathe the air again,
C             E
Tonight,
F                             Fm
maybe we’ll finally comprehend

C
That they mean nothing – words and letters,
E                                                           F
feathers of a bird, and birds fly together,
Fm
but alone, mute and voiceless souls

C
And I am you and I see me,
E
Gilmour wrote in seventy,
F
But you know it’ll never be,
Fm
but we know it’ll never be…

Posted by: Александър Макелов | December 21, 2012

## We’re back…

…in the game. Aw yeah.

It’s a bit unfortunate this happens at the end of the world, but even it can be a very fun place.

I’ve always been telling you I was not really blogging, and this past term at college has been taking up all my time, so there were not that many (read: none) cool posts around since August. The fall term itself was very fun fun fun, especially towards the end, but that’s another story for another blog post. Let’s just say that if the world ends tomorrow I’ll feel very much like this guy here doing the dangerous stunt if he could feel anything at all afterwards. Among the many things I learned over these past couple of months, a major one was that Klay world rulz. Most people (including me in a considerable fraction of the time) don’t really get the humor, but that’s not a reason not to watch it. Or to call it unfunny. Um… whatever. You, whoever you are (I’m pretty sure my readers are $\emptyset$, a.k.a. the empty set, but I don’t care, I read myself, damnit) can expect more cool stuff coming out of this blog in the next couple of weeks (well, as long as winter break lasts).

Posted by: Александър Макелов | December 21, 2012

## Yossarian lives!

“They’re trying to kill me,” Yossarian told him calmly.
“No one’s trying to kill you,” Clevinger cried.
“Then why are they shooting at me?” Yossarian asked.
“They’re shooting at everyone,” Clevinger answered. “They’re trying to kill everyone.”
“And what difference does that make?”

Joseph Heller, “Catch 22″

A METAPHORICAL SEARCH ENGINE.

A METAPHORICAL SEARCH ENGINE.

A METAPHORICAL SEARCH ENGINE.

It’s not a metaphor for a search engine. Get it? It’s a thing that finds metaphors for you. And it’s called “Yossarian Lives!”. Now how cool is that. I saw this sometime this summer, and recently the alpha’s image search has become operational. I tried it briefly and I have to admit the images it returned were pretty crazy and I could see a meaningful connection to my query in only a couple of them – but still, it was an interesting analogy. I was yossarianlives!ing for “moon” and I got devils. I then realized the shape of their horns resembled that of the moon crescent and was “wow”. Of course, there might have been many other connections I missed, due to the Stephen Fry problem (oh man I love these guys, they like everything I like).

Is the Stephen Fry problem just a convenient excuse? Is the final version going to be much better than the alpha? Are the images returned plain random? The future will show. However, the idea itself is amazing. “Outsourcing our minds”, bla bla bla. Shut up. Nothing (or at least, nothing yet) can outsource your mind, it can only inspire you to think deeper. Yossarian Lives!, if it lives up to its promise, will be a free, automated, non-stop service for blowing people’s minds. Remember the good old hanging around and not thinking about anything, just staring at the emptiness, when suddenly an amazing idea flashes through you mind, and you’re like “OMG THIS IS SO EPIC HOW COULD I NOT SEE THE CONNECTION BEFORE”? No more waiting for it to randomly happen – you just go to Yossarian Lives!, strike a couple of keys and be like “Wow. Wow. Wow. Wow….” for hours. An intellectual bomb. A mind-bender. In terms of a simple metaphor (haha), if the thing works as promised, we’ll have

$\frac{\text{Yossarian Lives!}}{\text{hanging around waiting for a flash}}=\frac{\text{taking the roller coaster}}{\text{walking to grandma's house}} \ \ \ (1)$

Is (1) good? Is it bad? Is it unnatural? Well, it’s tempting, and it could bring great change to the way people think about the world. And I think this is always good. If you don’t like it you just don’t use it.

Some other arguments the creators bring up (as if (1) is not enough) can be found in this very interesting essay. A great one is the following: search engines nowadays are, by nature, predicting their users and pointing them either to knowledge the majority of other people found useful (like, autocompletion), or to knowledge that is similar to what they searched for before. This may have many obvious advantages, but they come at a price: your knowledge horizon becomes conformist and hard to change. Search engines are trying to kill everyone. So they’re trying to kill you! It’s a pretty unfortunate Catch-22, isn’t it? On the other hand, the more subjective nature of the experience of understanding a metaphor has the potential to turn all this around (and confuse entire nations, I’m guessing, but there’s no other way).

Another reason why I find all this amazing is that this project seems to lie at the intersection of… everything. You notice this post is in almost all categories on my blog, as well as in Meta. Yossarian Lives!’s very heart is an objective process that seeks highly subjective results. The idea relates mathematics with art, determinism and rigorous theoretical ideas with the mind’s inner, sometimes seemingly arbitrary, associations and feelings. All fields of knowledge are basically clustered around these two poles, which often leads to people entirely dedicating themselves to one and forgetting the other, and consequently to lack of communication, understanding, and, I’m pretty sure, many interesting ideas. Well, I believe the poles are much closer than they appear to be to most people, and this project has a great potential to make me more right (:

So, what are you waiting for??? Go ahead and try it!

Posted by: Александър Макелов | November 3, 2012

## За математическите гимназии

Преместено от http://blog.parlamentaren-kontrol.com/ на 03.11.2012

Както казахме, новият закон за училищното образование е това, което ни подтикна да започнем да се занимаваме с www.parlamentaren-kontrol.com.

Проектозаконът привлече вниманието ни още през март и може да бъде намерен ето тук. Частта, която има значение, е в Чл. 36 (2). Забележете, че възможността “V-XII” клас отсъства. Според закона, единствените училища, които могат да обучават точно този интервал от класове, са спортните (виж Чл.37 (3)).

Проблемът с това е, че математическите гимназии в България традиционно предлагат прием след четвърти клас за най-способните деца. Преимуществата на тази система (спрямо прием след седми) са, според нас, големи и лесно видими; за това може да се говори още много в някоя от следващите ни публикации. За нас, като възпитаници на ПМГ-Бургас, е ясно че годините между четвърти и осми клас са незаменими в развитието на основите на математичеко мислене. След много проведени разговори с учители установихме, че ако този закон влезе в сила, математическите гимназии ще трябва или да се откажат от приема след 4-ти клас (вредно), или да въведат прием след първи (трудно и ненужно, а в някои случаи и физически невъзможно), или да сменят името и статута си (пак вредно). Според нас, никой от тези варианти не е приемлив – системата работи добре от десетки години и тези промени със сигурност няма да я подобрят.

Още през февруари/март бяха предприети действия от страна на родители и учители (виж например тук); събра се подписка (ето тази например; на нея има доста полезна информация за това как се развиваха нещата до юни) и ситуацията се успокои. През юли отново стана дума (например тук) и се оказа, че нищо не се е променило. Събрахме много съмишленици от различни общности и организирано изпращахме писма до народните представители, за да изразим несъгласието си; уви, в отговор не получихме почти нищо. Това, което знаем сега, е, че законът е бил приет на първо четене и през септември трябва да се гласува окончателно.

Posted by: Александър Макелов | August 20, 2012

## Google Summer of Code 2012: Week 13

Hi all, here’s a brief summary of my 13th (and last) week of GSoC.

• I continued my work on centralizers, improving normal closure, derived in lower central series, etc. My most recent pull request containing these additions just got merged and can be found here. This week I spent a lot of time on writing better tests and developing some new test practices. The group-theoretical algorithms in the combinatorics module are getting more and more complicated, so better, cleverer and more thorough tests are needed. I came up with the following model for verification:
- since the results of the tests are very hard to compute by hand, some helper functions are needed that find the wanted object in a brute-force manner using only definitions. For example, we often look for a subgroup with certain properties. The most naive and robust approach to this is to:
- list all group elements, go over the list and check each element for the given property.
- Then, make a list of all the “good” elements and compare it (as a set) with the list of all elements of the group the function being tested returns.
Hence, a new file was created, sympy/combinatorics/testutil.py, that will host such functions. (Needless to say, they are exponential in complexity, and for example going over all the elements of SymmetricGroup(n) becomes infeasible for n larger than 10.)
- The presence of functions being used to test other functions gets us in a bit of a Quis custodiet ipsos custodes? situation, but this is not fatal: the functions in testutil.py are extremely straightforward compared to the functions in perm_groups.py that they test, and it’s really obvious what they’re doing, so it’ll take less tests to verify them.
- In the tests for the new functions from perm_groups.py, I introduced some comments to indicate what (and why) I’m testing. Another practice that seems to be good is to verify the algorithms for small groups (degrees 1, 2, 3) since there are a lot of corner cases there that seem to break them.
• I started work on improving the disjoint cycle notation, namely excluding singleton cycles from the cyclic form; however, there are other changes to handling permutations that are waiting to be merged in the combinatorics module here, so I guess I’ll first discuss my changes with Christopher. Currently, I see the following two possibilities for handling the singleton cycles:
- add a _size attribute to the Permutation class, and then, when faced with something like Permutation([[2, 3], [4, 5, 6], [8]]), find the maximum index appearing in the permutation (here it’s 8) and assign the size of the permutation to that + 1. Then it remains to adjust some of the other methods in the class (after I adjusted mul so that it treats permutations of different sizes as if they leave all points outside their domain fixed, all the tests passed) so that they make sense with that new approach to cyclic forms.
- more ambitious: make a new class, ExtendedArrayForm or something, with a field _array_form that holds the usual array form of a permutation. Then we overload the __getitem__ method so that if the index is outside the bounds of self._array_form we return the index unchanged. Of course, we’ll have to overload other things, like the __len__ and __str__ to make it behave like a list. Then instead of using a list to initialize the array form of a permutation, we use the corresponding ExtendedArrayForm. This will make all permutations behave as if they are acting on a practically infinite domain, and if we do it that way, we won’t have to make any changes to the methods in Permutation – everything is going to work as expected, no casework like if len(a) > len(b),... will be needed. So this sounds like a rather elegant approach. On the other hand, I’m not entirely sure if it is possible to make it completely like a list, and also it doesn’t seem like a very performance-efficient decision since ExtendedArrayForm instances will be created all the time. (see the discussion here).
• Still nothing on a database of groups. I looked around the web for a while but didn’t find any resources… the search continues. Perhaps I should ask someone more knowledgeable.

That’s it for now, and that’s the end of my series of blog posts for the GSoC, but I don’t really feel that something has ended since it seems that my contributions to the combinatorics module will continue (albeit not that regularly : ) ). After all, it’s a lot of fun, and there are a lot more things to be implemented/fixed there! So, a big “Thank you” to everyone who helped me get through (and to) GSoC, it’s been a pleasure and I learned a lot. Goodbye!

Posted by: Александър Макелов | August 16, 2012

## John Mayer: Queen of California lesson

Shortest. Post. Ever.

Yep, Disney movies can show you (or, alternatively, in Disney movies you can find) more truths about real life than you might expect. And it’s not just subliminal messages. Anyway, ‘Queen of California’ from John Mayer’s 2012 album “Born and raised” is a pretty decent song with a pretty good (California style!) video. It is worthy of some space here, so…

Not only that the main riff is absolutely cute and addictive, but the lyrics make some sense and have references to (forgotten but not gone! haha) musicians – Neil Young and Joni Mitchell.

Here’s a short video that I recorded showing how to play the parts of the song (sort of. this is mainly for my own future reference, one day when I want to play it again); it’s low quality (the video and the playing) and I missed a couple of notes, but that’ what you get with me and a Nokia 5700. There’s one strumming pattern with some pull-offs and hammer-ons (that’s the cute main riff), a couple (literally) of chords and a short solo. Capo’s on 4th.

Posted by: Александър Макелов | August 13, 2012

## Google Summer of Code 2012: Week 12

Hi all, here’s a brief summary of the 12th week of my GSoC:

• Centralizers got some more attention since there were several bugs in the implementation from last week; this also exposed a bug in .subgroup_search() as it is on sympy/master right now. Fortunately, I located it and fixed it earlier today, so the fix for .subgroup_search() will be contained in my next pull request. In fact, it is just three more lines that should be added. Namely,
# line 29: set the next element from the current branch and update
# accorndingly
c[l] += 1
element = ~(computed_words[l - 1])


should be replaced with

# line 29: set the next element from the current branch and update
# accorndingly
c[l] += 1
if l == 0:
element = identity
else:
element = ~(computed_words[l - 1])


since we might be at the bottom level with $l=0$. In this case, python doesn’t yell at you for looking up computed_words[-1] since negative indices wrap around the list in python. Yet another silly mistake that’s incredibly hard to track down! I hope that it will work properly from now on, and I’ll have to include some more tests to it.

• The description of the algorithm for finding the center in polynomial time given in [1] didn’t really make sense to me, so instead a straightforward one,
def center(self):
return self.centralizer(self)


was used. This can be updated later when I (or someone else) figures out the polynomial-time algorithm.

• A new, faster algorithm for finding normal closures: this one uses the incremental version of Schreier-Sims, and some randomization. It’s described in [1].
• Some applications of normal closure: the derived series, lower cenral series, the commutator of two subgroups of a group, nilpotency testing. Now we have things like this:
In [68]: from sympy.combinatorics.named_groups import *
In [69]: S = SymmetricGroup(4)
In [70]: ds = S.derived_series()
In [71]: len(ds)
Out[71]: 4
In [72]: ds[1] == AlternatingGroup(4)
Out[72]: True
In [73]: ds[2] == DihedralGroup(2)
Out[73]: True
In [74]: ds[3] == PermutationGroup([Permutation([0, 1, 2, 3])])
Out[74]: True


demonstrating the well-known normal series of groups $e < K_4 < A_4 < S_4$ that solves the symmetric group on 4 letters. Note that the normal closure algorithm was already there thanks to the work of Mario, I just improved it a bit and added some applications.

• Moved DirectProduct() to a new file, group_constructs.py, that is planned to hold functions that treat several groups equally (for one other example, the commutator of two groups in the full symmetric group) rather than treating them in some sort of subgroup-supergroup relationship (such as .centralizer()).

I wrote docstrings for the new stuff, and my current work can be found on my week10 branch. There will be some comprehensive test following the new additions (and I’ll need GAP to verify the results of some of them, probably). It seems that Todd-Coxeter won’t happen during GSoC since there’s just one more week; instead, I plan to focus on improving disjoint cycle notation and group databases.

[1] Derek F. Holt, Bettina Eick, Bettina, Eamonn A. O’Brien, “Handbook of computational group theory”, Discrete Mathematics and its Applications (Boca Raton). Chapman & Hall/CRC, Boca Raton, FL, 2005. ISBN 1-58488-372-3

Posted by: Александър Макелов | August 12, 2012

## Think Small: Part II, blue eyes

Ah, Intuition takes me there
Intuition takes me everywhere

John Lennon

Not exactly everywhere. But whatever, there’s a problem in this post, and to avoid me spoiling the solution with my continuous babbling, I would suggest that you skip directly to the part called “The problem” below.

Here I continue my discussion from this post regarding logic, the downfalls of intuition, and the benefits of looking at the boundary solutions for a given problem (or the small cases, if you prefer to call them that way in this context). This time, it seems, the problem under investigation is a bit harder.

I. The problem

So, there’s an island, and there are people on it: 100 of them have blue eyes, 100 have brown eyes, and one has green eyes. Nobody knows the color of their own eyes or the distribution of eye colors on the island. Every night at midnight, a ship comes to the island and takes away all the people who know for sure the color of their eyes. Everyone wants to find out the color of their own eyes and get away from the island. People on the island are not allowed to communicate in any way, and can’t use silly tricks like looking at their reflections in the water. They can only look at each other, and in particular a person with blue eyes will observe 99 people with blue eyes, 100 people with brown eyes and 1 person with green eyes.

Finally, and as usual, all the people on the island are wise men/women, and if there is some logical argument that can be made, they make it instantaneously.

The only thing that happens on the island for all eternity (I know, I’m breaking the law of non-communication here, but that’s the only violation) is that one day at noon, the green-eyed person gathers all the other 200 people so that they can all see each other and says, “I can see a person with blue eyes.” All the other people know he’s telling the truth : ) (after all, these are decent wise people).

The question is the following: who is going to leave the island, and when?

Now think about it (while listening to this, perhaps? : ) )

II. Psychology

The dominating feeling people get from this problem is confusion. Many bring up the following argument: “What difference does it make that the green-eyed person says so and so? They can all see that there are people with blue eyes!” and then try to extract something more from the statement of the problem by asking questions about it. But it tells you everything you need to know, and there are no tricks involved: the solution is a logical argument. Of about twenty people, three managed to get to the answer. And getting to the answer seems to be the easier part – proving it rigorously and making sense of it on a more intuitive level is actually harder.

But I feel that the real issue here is not that people are unable to solve the problem – rather, they refuse to approach it, especially after they get confused by the fact that the words of the green-eyed person seemingly “don’t provide any new information”, whatever that means. It’s as if they close their minds, even though I tell them that there is a logical argument in support of the claim that his words actually change something. It’s just so counter-intuitive.

Another reason for not really thinking about the problem seems to be low self-confidence when it comes to logic puzzles (and this problem of low self-confidence applies to all of us in many other contexts …). People say things like, “I’m terrible at such problems!”, or “I’m not that smart, I can’t solve it!”, etc. I find this attitude really harmful! After thinking about this for a while, it seems to me that this is such a bad (and sort of ironic) misunderstanding. It does take intelligence to solve this problem – but I believe that what demonstrates intelligence even more is the way you approach it. Even if you can’t solve it, if you continue to think hard about it you surely increase your chances – that’s sort of obvious, right? And thinking hard is always good – in fact, it is the best way to increase your intelligence. So… it might seem strange, but the quality of not giving up and working towards improving your current situation seems to be a premise – and thus, later in your life, a sign – for being smart; and given the fact that people can often achieve more than they think, increased self-confidence seems to be one other such sign : ) But enough with the psychology stuff for today.

This puzzle is shamelessly advertised as “The hardest logic puzzle in the world” here at xkcd. Their (his) explanation of the parts that are hardest to grasp was sort of “OK, see – I’m right!” and a bit unsatisfactory – indeed, it’s hard to discuss it in depth (and I’m not sure if I can provide a more insightful explanation, but I’ll try).

A discussion on the answer will follow in a subsequent blog post : )

Posted by: Александър Макелов | August 6, 2012

## Google Summer of Code 2012: Week 11

Hi all, here’s a brief summary of the 11th week of my GSoC.

• Yay! Subgroup searching now works with the use of .stabilizer(), as I discussed in my previous blog post. Surprisingly, the running time is similar to that of the flawed version using .baseswap() (whenever the one using .baseswap() works), you can play around with the two versions on my week6 (has a bug, using .baseswap()) and week9 (seems to work, using .stabilizer()) branches.
• Consequently, I made a new pull request containing the incremental version of Schreier-Sims, the remove_gens utility for getting rid of redundant generators in a strong generating set, and the new (working) subgroup_search algorithm. You’re most welcome to help with the review!
• I worked on several applications of subgroup_search() and the incremental Schreier-Sims algorithm. Namely, the pointwise stabilizer of a set of points (via the incremental Schreier-Sims algorithm):
In [4]: from sympy.combinatorics.named_groups import *
In [5]: A = AlternatingGroup(9)
In [6]: G = A.pointwise_stabilizer([2, 3, 5])
In [7]: G == A.stabilizer(2).stabilizer(3).stabilizer(5)
Out[7]: True


(this is much faster than the naive implementation using .stabilizer() repeatedly), and the centralizer of a group $H$ inside a group $G$:

In [11]: from sympy.combinatorics.named_groups import *
In [12]: S = SymmetricGroup(6)
In [13]: A = AlternatingGroup(6)
In [14]: C = CyclicGroup(6)
In [15]: S_els = list(S.generate())
In [16]: G = S.centralizer(A)
In [17]: G.order()
Out[17]: 1
In [18]: temp = [[el*gen for gen in A.generators] == [gen*el for gen in A.generators] for el in S_els]
In [19]: temp.count(False)
Out[19]: 719
In [20]: temp.count(True)
Out[20]: 1
In [21]: G = S.centralizer(C)
In [22]: G == C
Out[22]: True
In [23]: temp = [[el*gen for gen in C.generators] == [gen*el for gen in C.generators] for el in S_els]
In [24]: temp.count(True)
Out[24]: 6


(it takes some effort to see that these calculations indeed prove that .centralizer() returned the needed centralizer). The centralizer algorithm uses a pruning criterion described in [1], and even though it’s exponential in complexity, it’s fast for practical purposes. Both of the above functions are available (albeit not documented yet) on my week10 branch.

• The next steps are an algorithm for the centre in polynomial time, and an algorithm to find the intersection of two subgroups! And after that, I hope to be able to implement the Todd-Coxeter algorithm…

That’s it for now!

[1] Derek F. Holt, Bettina Eick, Bettina, Eamonn A. O’Brien, “Handbook of computational group theory”, Discrete Mathematics and its Applications (Boca Raton). Chapman & Hall/CRC, Boca Raton, FL, 2005. ISBN 1-58488-372-3

Posted by: Александър Макелов | July 30, 2012

## Google Summer of Code 2012: Week 10

Hi all,

here’s a brief summary of what I’ve been doing during the 10th week of my GSoC.

• Though I fixed a bug in the SUBGROUPSEARCH function during the week, I ran some more comprehensive tests as I had planned to, and some of them broke the function. If you’re particularly interested, something like that will work:
In [87]: S = SymmetricGroup(5)
In [88]: prop_fix_3 = lambda x: x(3) == 3
In [90]: S.subgroup_search(prop_fix_3)
---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
<ipython-input-90-6b85aa1285b8> in <module>()
----> 1 S.subgroup_search(prop_fix_3)

/home/alexander/workspace/sympy/sympy/combinatorics/perm_groups.py in subgroup_search(self, prop, base, strong_gens, tests, init_subgroup)
2660
2661                 # this function maintains a partial BSGS structure up to position l
-> 2662                 _insert_point_in_base(res, res_base, res_strong_gens, l, new_point, distr_gens=res_distr_gens, basic_orbits=res_basic_orbits, transversals=res_transversals)
2663                 # find the l+1-th basic stabilizer
2664                 new_stab = PermutationGroup(res_distr_gens[l + 1])

/home/alexander/workspace/sympy/sympy/combinatorics/util.py in _insert_point_in_base(group, base, strong_gens, pos, point, distr_gens, basic_orbits, transversals)
423     # baseswap with the partial BSGS structures. Notice that we need only
424     # the orbit and transversal of the new point under the last stabilizer
--> 425     new_base, new_strong_gens = group.baseswap(partial_base, strong_gens, pos, randomized=False, transversals=partial_transversals, basic_orbits=partial_basic_orbits, distr_gens=partial_distr_gens)
426     # amend the basic orbits and transversals
427     stab_pos = PermutationGroup(distr_gens[pos])

/home/alexander/workspace/sympy/sympy/combinatorics/perm_groups.py in baseswap(self, base, strong_gens, pos, randomized, transversals, basic_orbits, distr_gens)
2472             # ruling out member of the basic orbit of base[pos] along the way
2473             while len(current_group.orbit(base[pos])) != size:
-> 2474                 gamma = iter(Gamma).next()
2475                 x = transversals[pos][gamma]
2476                 x_inverse = ~x

StopIteration:



The reason is certainly the change of base performed on line 11 in the pseudocode (this is also indicated in my code on my local week6 branch here ). The use of the function BASESWAP there is what gets us into trouble. It is meant to be applied to  base and a strong generating set relative to it, switch two consecutive base points and change the generating set accordinly.  However, in subgroup_search the goal is to change a base $(b_1, b_2, \ldots, b_l, \ldots, b_k)$ to $(b_1, b_2, \ldots, b_l', \ldots, b_k)$ where $b_l'$ is a new point. The book ([1]) mentions that this is done by using BASESWAP but doesn’t provide any details. My strategy is the following: I cut the base so that it becomes $(b_1, b_2,\ldots, b_l)$ and cut the correponding data structures – the strong generators strong_gens, the basic_orbits,  the transversals, and the strong generators distributed according to membership in basic stabilizers distr_gens (I know, I still have to rename this to strong_gens_distr). Then I append the point $b_l'$ so that the base is $(b_1, b_2, \ldots, b_l, b_l')$ and calculate an orbit and transversal for $b_l’$ under the stabilzier of $b_1, b_2, \ldots, b_l$. Finally I apply BASESWAP to this new base in order to switch the two rightmost points. Then I go back to $(b_1, b_2, \ldots, b_l', \ldots, b_k)$ by appending what I had cut in the start and calculating a transversal/orbit for $b_{l+1}$ under the stabilizer just found, that of $b_1, \ldots, b_l'$. Obviously, the resulting BSGS structures are valid only up to position $l$, and that’s all the information we can acquire without another application of baseswap or finding another stabilizer ( and in general, finding a stabilizer is a computationally hard task relative to calculating orbits/transversals). The entire purpose of this use of BASESWAP in SUBGROUPSEARCH is to obtain generators for the stabilizer of $b_1, b_2, \ldots, b_l'$ and maintain a base/strong generating set that are valid up to a certain position. There are many such base changes performed on the same base throughout the course of the function and something goes wrong along the way. I still have to figure out why and where.

• The good news: There is a straightforward alternative to using BASESWAP: maintain a list of generators for each of the basic stabilizers in $(b_1, b_2, \ldots, b_k)$ and change it accordingly as the base is changed, using the function stabilizer() in sympy/combinatorics/perm_groups.py. For each base change we have to calculate one more stabilizer, so that’s not terrible. It is also sort of suggested in “Notes on Computational Group Theory” by Alexander Hulpke (page 34). The problem with this approach is that stabilizer() tends to return a group with many generators, and repeated applications keep increasing this number. However, using this removed the bug from SUBGROUPSEARCH. As before, more comprehensive tests are on the way : )
• Yet another alternative : we can use the incremental Schreier-Sims algorithm with the new base $(b_1, \ldots, b_l', \ldots, b_k)$ and the strong generating set for $(b_1, \ldots, b_l, \ldots, b_k)$. There will likely be redundant generators after that, and it will probably involve more computation than finding a single stabilizer. However, in the long run (since there are many base changes performed) this might perform faster (due to the increasing number of generators that stabilizer() tends to create). I have not tried that approach yet.
• Other than that, I had my latest major pull request merged! Thanks a lot to Stefan and my mentor David for the review! That was the largest one so far…
• I started reading about some of the applications of subgroup search; subgroup intersection seems to be the easiest to implement, so I’ll probably go for it first.

That’s it for now : )