Categories

## Picking Arbitrary Values and Numberline Subtraction

Society has a plethora of arbitrary values. I was inspired to see that kids are learning subtraction using the concepts of distance and the number line (LearnZillion: Solve subtraction problems using a number line). I’ll give an example if you didn’t check out the link.

1. Pick two numbers `x, y` (given: `273, 834`).
2. Construct a number line with the given numbers as points:
`<--273---------------------------------834-->`
3. Step up or down from the numbers in hops:
`<--273-(1)-274-(60)-334------(500)-----834-->`
4. Add up the hop distances:
`500 + 60 + 1 = 561`

So `834 - 273 = 561`.

But the neat thing is that it gives children the chance to learn about making choices of where to hop. Given `105 - 35` they might hop to `55` and then to `105` or they might hop (bidirectionally) to `40` and `100`.

The best choices for this sort of subtraction is, as far as I can tell, the following:

1. For each common column, from smallest to largest, hop from the low number until that column is normalized.
2. If the last hop increased the column count, include that column as a common column.
3. Add the remaining uncommon amount of the larger number.

So for `123,456 - 789`:

``````<--789-(7)-796-(60)-856-(600)-1,456-(2,000)-3,456---(120,000)---123,456-->
120,000 + 2,000 + 600 + 60 + 7 = 122,667
``````

At each step we only focus on matching the single column. If we overrun the default number of columns for the smaller number (eg, `856 + 600 = 1,456`), we may take more steps. But we will never add more than nine of whatever unit size we’re focused on.

So in this case we probably have a good algorithm for picking what would otherwise be arbitrary hops. Kids can still learn the method without this algorithm, and they can play around with finding their own hops.

But we find arbitrary numbers throughout the law and in our daily lives. They have economic, social, and psychological ramifications. Tax brackets tend to be based on arbitrary income levels, for example. Inflation and other factors (such as the number of people with incomes previously considered outliers increase) may invalidate those existing, arbitrary values.

We should tend to avoid arbitrary values in the law. Fines should be based on an individual’s income, as is done in some European countries. Fining a poor person the same as a rich person for a minor infraction such as speeding makes zero sense. Either the fine will be excessive for the poor person, or it will be meaningless to the rich person.

We may again face problems with arbitrary values as new technologies come along. Autonomous vehicles may be able to safely exceed speed limits, but will undoubtedly be forced to comply with limits that make little sense for years beyond the widespread adoption of such vehicles.

And yes, the federal budget. What amount should the budget be? We have endless scoring of laws and regulations from the Congressional Budget Office and Office of Management and Budget. But when we actually formulate the budget, it is entirely arbitrary. It is based on whims and beggings of special interests, or on emotional appeals for the social welfare.

I favor social welfare, but just as prison sentences should be chosen for their effect and not out of emotional reflexes, so should social welfare programs budgets.

But at least young kids will become acquainted with picking arbitrary values using the number line. Maybe they will find algorithms for picking other values that have profound repercussions on society. Or maybe they’ll just get better at picking the arbitrary ones.

Categories

We all know that the incorporated politicians and the incorporated media are not doing their jobs properly. They are twisting every aspect of reality in an attempt to wring out every last ounce of money and power they can get. All without a thought toward their long-term profitability.

But one key to their deception is found in mathematics. Not high-level holy-cow-you-can-do-THAT kind of math, but just a trick so simple that you’ve probably been graded down a hundred times for doing it on accident.

That trick is leaving things out. Oops, you forgot to carry the one. Your answer is wrong. -1. But when they do it, they seldom get marked off. They are bold enough to dispute everything.

One example of this I’ve seen lately is the math of activity-impacts on climate change. Whether it’s calculating that an electric car pollutes more than a combustion car, or that bicycling is worse than the combustion car, or that the average car moves at so many miles per work-hour.

To calculate these things is an exercise in aggregation. And it’s easy to leave some out. It’s difficult to not disclaim the result, or discuss why you may be wrong. And that’s the bit the incorporated entities leave out. They leave out the humbleness of humans. They act like the math is so obvious that it couldn’t possibly be wrong.

Guess they haven’t learned anything from the math that sank the markets only a stone’s throw back.

But it is the humility, the acquiescence to reason and margin for error, that marks the true champions of our species. The incorporated have no humility for the masses. They are there to sell. A sale cannot be predicated on an admission of doubt, for then caveat emptor (may the buyer beware). Can’t have that.

Or can we? I question with only mild reservation the sage wisdom that politicians must follow that line, where the candidate cannot honestly say, “maybe my opponent is your better choice for you. I believe I’m better, and I will make that case, but I may in fact be wrong.”

I question the wisdom that the climate skeptics and deniers try to sell, that we ought do nothing. Any who will say, “though you may be in grave danger, do nothing until such time as blood is drawn,” must either be kin to the undertaker, of a sadistic bent, or simply deluded.

Indeed, if there had been humility leading to the war against Iraq, it might have taken a far different course, as if there had been the same skepticism applied to the claims of that administration as there are to the science of the climate.

Categories

## The Euclidean Algorithm

This post regards the Euclidean Algorithm for determining the Greatest Common Divisor (GCD) of two integers.

I happened to read about this fun and simple algorithm and decided since I’ve been doing some C programming to take a little time to implement this in C. The version below outputs to the console via printf, but could easily be modified to return a value and thus be used as part of other programs.

Here it is:

```[snip out GPL notice, it's in the actual file though]
#include <stdio .h>
#include <stdlib .h>
#include <limits .h>
#include <errno .h>

int
main(int argc, char **argv)
{
int a,b,r; // declare variables

if (argc < 3)
{
printf("usage: gcd <value> <value> where neither == 0\n");
exit(-1);
}

b = strtol(argv[1], NULL, 10); // get values from command line
if (errno != 0 && (b == LONG_MIN || b == LONG_MAX)) // ensure valid input
{
exit(-1);
}

r = strtol(argv[2], NULL, 10);
if (errno != 0 && (r == LONG_MIN || r == LONG_MAX))
{
exit(-1);
}

if (b < r) // order them properly
{
a = r;
r = b;
b = a;
}

while (r != 0) // keep going until GCD found (worst case it's 1)
{
a = b; // shuffle values to correct spots
b = r;

if ((r = a % b) == 0) // compute the remainder, if it's 0 then GCD found
{
printf("The GCD is: %d\n", b);
exit(0);
}
}
printf("usage: gcd <value> <value> where neither == 0\n");
exit(-1);
}

```

If I’ve made any grievous errors or there’s just a better way please let me know. This code is released under the GPL.