# strongarm

I made a quick maths tool this week called strongarm. It's a reverse sum-finder. If you give it an answer, it will give you some simple sums that are close to your answer. Why is this useful? Good question...

## brute forcing

I love maths, especially recreational maths; the less-useful the better! I'm quite bad at actually solving problems, but brute-forcing problems is very easy for a programmer. Instead of doing proper maths, you can just calculate an infinite sum for the first million terms, or try a million data points to get an idea of the probability of something. This is great for getting an idea of the approximate answer or double-checking your solution.

If you know the answer to 5 or so significant figures and the solution is a simple equation within the following limitations then you can use strongarm to look up the answer.

## limitations

Strongarm can only help find sums that...

- include only the operations multiply, divide, add, subtract, exponentiate, natural-log, square-root (and brackets)
- have 3 or fewer variables that are in the list (tau, pi, phi, e, 1, 2, 3, 4, 5, 6)
- are 14 or fewer characters long
- have a non-integer answer between -1000 and 1000

For example:

- 2+pi
- 2^(e*3)
- 1/sqrt(5)

## examples

### Basel Problem

I was initially messing around with random infinite sums and tried 1/(n^2) for n=0-100000 and came across pi^2/6 and recognised it from probably some youtube video. It's cool to stumble across it without realising. Though it is a lot easier to find an answer with strongarm when you already know it :)

### random powers

If you take two uniform random numbers between 0 and 1 and raise one to the power of the other, the average result appears to be log(2)! That's cool, I wonder why.

### length 2 random walk

If you take two uniform random numbers between -1 and 1 and add them together, the average absolute sum seems to be 2/3. Not exactly showing off the utility of strongarm but I didn't notice before I pasted it in hehe. 3 random numbers seems to be 13/16, I bet there's some interesting maths to dive into there.

### hexagon distance

I thought I'd try finding the ratio between a hexagon's diagonal and its height. This is useful if you want to make a hexagonal grid and I never remember the formula. My brute-forcing method was to slowly and painstakingly manually position one hexagon until it was flush with the other and then keep zooming in and repositioning.

I eventually got 0.866025 which is sqrt(3/4)! I think hexagons aren't usually defined by their diagonal, which is how I draw them. It does seem to be correct though, judging by this calculator.

## tips

You need to know the answer to about 5 significant figures to get anything useful from this. It can be hard to know how accurately you have brute-forced something but I recommend brute-forcing it a few times and checking how many digits always stay the same.

Be very skeptical about any result. There are so many ways to combine these operations and it's possible that one is just very close.

Just because it seems like your problem should have a simple answer, it's possible that it doesn't. Or that it doesn't fit into the many limitations.

no comments yet