Sunday, June 30, 2019

Partitioning the Vote

My earlier notion for preventing gerrymandering was not very effective. Looking at the data for the Michigan 2018 election, the Democrats had a majority of the vote but a minority of the districts. My proposed rule would have done nothing to prevent that.

Exactly what a good rule might be, I don't know. It's a difficult problem! But the basic criterion that seems logical is that the fraction of districts won by each party should be roughly proportional to the fraction of votes for that party. A general shift in voter preference should be reflected with a proportional shift in election results, in the fraction of districts won by a party. This would be achieved by having district boundaries drawn so that the fractions of votes for each party across the districts varies across a reasonably wide spectrum.

The challenge with this approach is that the notion of "a general shift" is too vague to be of much use. Still, a simple model can get the idea across.

Here is an idealized situation, a state with ten districts. When the vote is split equally, the range of district results could be:

With a general drift to 60% of the vote for one of the parties, the number of districts won could change proportionally:

A further shift, to 70%, would continue to be reflected in the proportion of districts won:

Thursday, June 27, 2019

Against Gerrymandering

The notion of a free market strikes me as oxymoronic. It's like a game without rules. It's nonsense. A game is defined by its rules. Similarly, markets are defined by rules. Of course, good games and good markets have rules that are fair, for example. Finding ways to structure markets effectively is a worthy challenge.

The recent Supreme Court decision, to keep the federal judiciary out of the business of how to draw the boundaries of legislative districts, strikes me as a move in support of a free political market. Why try to figure out what a fair market might look like? Let the market decide what is fair! But the problem with anarchy is that it is impossible. We can decide on rules using methods developed over the centuries and codified by brilliant political thinkers like the framers of the United States Constitution, or we can revert to the cruder methods of tyrants.

Of course the framers didn't provide all the answers. We the people have the responsibility, working with the general framework set out in the constitution, to work out the rules and regulations, the laws and institutions, by which we may prosper fairly and equitably.

It's clear enough that legislative boundaries can be gerrymandered to amplify the dominance of whichever party. Even if some branch of the government took on the task of preventing such corruption, it's not so clear what kind of rule could work against it effectively. I would like to propose a rule here that could work.

The basic trick used in gerrymandering is to concentrate the voters of the minority party. The voters of the majority party are spread across districts, so there are just enough to win in a very large number of districts.

So here is an effective anti-gerrymandering rule: for each x, there cannot be more districts with more than (50+x)% minority party voters than there are districts with more than (50+x)% majority party voters.

In other words, minority party voters cannot be concentrated in districts more than majority party voters are.

This is a simple rule that would prevent the worst abuses of gerrymandering.

Thursday, November 29, 2018


Canvas not supported; please update your browser.

log(Temperature) =

Energy =

This little project is based on Dan Schroeder's Ising Model animation.

The way this kind of simulation works is that cells in the array are considered one by one. At a particular cell, alternative configurations are examined and one configuration is selected to be newly assigned to the cell. Each possible configuration, or value of the order parameter, will have an energy which is determined by the configurations of the neighboring cells. The new configuration is picked at random, with a bias toward lower energy configurations. The lower the temperature, the stronger the bias.

One of the tricky parts about this kind of simulation: when the order parameter is continuous, it's hard to come up with a good set of alternative values. The full set of alternatives is huge, practically infinite. Some small sample needs to be used. The small sample needs to include some configurations whose energy is at least not too much worse than the existing configuration, or the simulation won't have a good alternative to assign to the cell. At high temperatures, suitable alternatives can be substantially worse. At low temperatures, the alternatives can only be slightly worse. Thus, the temperature determines what makes a good set of alternatives. Trying to figure out that relationship ahead of time is too complicated, so an adaptive approach is suitable.

What I do in this simulation is to consider alternatives one by one. The first alternative is chosen at random at random from the full set. Each next alternative is chosen from those that are within some range of the currently assigned configuration. As each configuration is chosen, a decision is made whether to assign that to the cell in place of the current configuration. As soon as a new configuration is assigned, the simulation moves on to look at other cells. When an alternative is not assigned, another alternative is chosen from a narrower range. The range from which alternatives are picked gets narrower and narrower with each iteration. Eventually the alternatives are so close to the current assignment that the odds of being assigned become 50/50. This narrowing range iteration provides an adaptive approach to picking a set of alternative configurations.

Wednesday, November 28, 2018


Left Side Offset:

Left Side Direction:

Right Side Offset:

Right Side Direction:

Canvas not supported; please update your browser.

Interaction Energy =

The foundation for the dynamics of a system is the way the components interact. The "wrinkles" system that I am exploring is a two dimensional array of cells. Each cell interacts with its four neighbors. The state of each cell is given by a direction and an offset. These change over time. In the thermodynamic simulation that I am building, a cell will tend to change so its direction and offset are similar to those of its neighbors.

Handling the offset gets tricky. The idea is that the dark and light strips should line up on the boundary between neighboring cells. If the cells have the same direction, the offsets should simply match. But when the cells have different directions, it gets messy!

What I'm doing to manage this is to look solely at the midpoint of the edge that forms the boundary between two neighboring cells. The offsets are close if the stripes fit together at that midpoint.

There is some topological strangeness here. The light and dark stripes have a symmetry: if you turn them upside-down, the result is the same pattern as where you started. But at the two extremes of cell direction, increasing offset will move the stripes in the opposite direction. Changing the direction rotates the stripes: every 180 degree brings the stripes back to where they were. Similarly, changing the offset enough will move the stripes back to where they started. So the topology of these two parameters together forms a kind of torus. But because the direction of offset is reversed after a 180 degree change of direction, the topology is actually that of a Klein bottle. This topology is what allows an array such as:

Monday, November 26, 2018

Order Parameter

My plan is currently to develop an animation for the "wrinkles" simulation I built a while back. Mostly it's a matter of translating C# into javascript. But I'll develop it in stages, from the ground up. That'll give me an opportunity to explain the bits and pieces which will also work as a kind of unit test.

Canvas not supported; please update your browser.



Quite a blast, huh?! I am using Dan Schroeder's tutorial to figure this stuff out!

In case anybody else wants to play like this in blogger... I am not entirely sure, but it seems like variables are shared across scripts, across posts. The code I put in one post interacts with the code I put in other posts. So far I am managing this by making lots of new variable names. Maybe there is a better way, but I don't really plan to take this little project very far anyway!

Sunday, November 25, 2018


Maybe the time has finally come to learn javascript! Take a look at Dan Schroeder's Ising Model!

Just too much fun! Step 1: just get javascript to work here!

Canvas not supported; please update your browser.

That little red dot doesn't look like much, but.... if you search on how to put javascript into a blogger post, you can find quite a bit of complicated advice. After trying a lot of it, I just did the simplest thing that I was repeatedly warned wouldn't work - I just put the javascript in my post! Look! A red dot!

Sunday, September 2, 2018

Capital Gains Indexing

I have seen reports that the President is considering changing the accounting of capital gains for tax purposes, adjusting the cost basis to reflect inflation. This would of course reduce the gain, and thus reduce the tax. Since almost all capital gains are earned by the very wealthy, and those taxes therefore paid by the very wealthy, this would be be a dramatic tax cut for the wealthy. These days the old maxim, the rich get richer, is as true as ever, so it would seem that such a tax cut is not at all appropriate.

However, it would be very simple, from an accounting perspective, to adjust for inflation in capital gains taxation in a revenue-neutral way. Of course, a change in tax accounting will change behavior, so precise revenue neutrality is too much to expect. But the resulting change in behavior should have great benefit to the economy and society. Short term capital gains are earned largely through speculation, taking advantage of price fluctuations. Long term capital gains are earned through investment, where the growth in underlying value is the primary determinant. This growth in underlying value is what benefits society. The tax code should encourage long term investment. Long term capital gains should be taxed at a lower rate than short term capital gains. This would be the effect of adjusting the basis to reflect inflation. Simply increasing the tax rate on capital gains could easily make the new accounting revenue neutral.

A parallel accounting adjustment would help the middle class. Interest earned should be corrected for inflation. When inflation is running at say 2% while bank savings accounts are paying 0.1%, perhaps the smart move would be to make the 1.9% loss a tax deduction. This would encourage savings and help middle class families build nest eggs.