This story:
http://www.nytimes.com/2010/04/29/technology/29cashless.html?hpw
had me thinking about the idea that one model of reality could just be particles as free agents exchanging money (energy) through exchanges (collisions).
This story:
http://www.nytimes.com/2010/04/29/technology/29cashless.html?hpw
had me thinking about the idea that one model of reality could just be particles as free agents exchanging money (energy) through exchanges (collisions).
Via: http://rc3.org/2010/04/25/becoming-a-better-programmer/
I had two bugs in my first implementation: one was a reversed order of operands in “int size = end - start;”, as “int size = start - end;”, and the second was returning “middleValue” instead of “middle”. Otherwise I think it is correct, avoiding the int overflow problem (unintentionally) I believe.
public class BinarySearch {
public static void main(String[] args) {
int[] numbers = new int[]{0, 1, 3, 5, 7, 8, 9, 20, 45, 100, 876, 1000, 1001};
int value = 45;
System.err.println(“numbers:”);
for (int i = 0; i < numbers.length; ++i) {
System.err.println(i + ” : ” + numbers[i]);
}
System.err.println(“value: ” + value);
int found = find(value, numbers, 0, numbers.length);
System.err.print(“found at index: ” + found);
}
public static int find(int value, int[] numbers, int start, int end) {
System.err.println(“finding”);
System.err.println(“start: ” + start);
System.err.println(“end: ” + end);
if (start == end) {
if (numbers[start] == value) {
return start;
} else {
return -1;
}
}
int size = end - start; // size is at least 1 thanks to above condition.
int middle = start + size / 2; // rounds down; middle may == start.
System.err.println(“middle: ” + middle);
int middleValue = numbers[middle];
System.err.println(“middleValue: ” + middleValue);
if (middleValue == value) {
return middle;
} else if (middleValue < value) {
// take the top range of the array.
return find(value, numbers, middle + 1, end);
} else {
// take the bottom range of the array.
return find(value, numbers, start, middle);
}
}
}
numbers:
0 : 0
1 : 1
2 : 3
3 : 5
4 : 7
5 : 8
6 : 9
7 : 20
8 : 45
9 : 100
10 : 876
11 : 1000
12 : 1001
value: 45
finding
start: 0
end: 13
middle: 6
middleValue: 9
finding
start: 7
end: 13
middle: 10
middleValue: 876
finding
start: 7
end: 10
middle: 8
middleValue: 45
found at index: 8
As it turns out.
I like commenting, but blogging without feedback… not really.
I watched (most of) Jaws again last night. It really is a spectacularly good movie, with two standout scenes even by that high bar. The first is when Roy Scheider is sitting at the dinner table with his son and notices that the son is imitating him. So there’s this little scene where they are interacting that has no immediate narrative purpose; it’s pure observation. The second is the scene where Quint, Brody, andHooper are sitting around in the boat getting drunk and comparing scars & war stories. Both come from a type of filmmaking that seems to be out of style: the idea that even an action/SFX movie like Jaws should take some time out from directly and obviously advancing the plot to spend some time just watching the characters being themselves and interacting.
I feel like at the end of most movies these days, I can tell you the plot, I can tell you the motivations of the characters, maybe even their backstory; but I have no idea what it would be like to sit down with them. There is no time for anything that doesn’t directly advance the plot.
I’m going to experiment with posting links to the more interesting (ha ha) comments I have posted elsewhere.
This is one on the subject of Taliban involvement in Afghan political reconciliation over at ObWi:
Except of course today I didn’t keep track and that’s the only one. But hey.
http://www.nytimes.com/2009/12/12/health/12medicaid.html
“The data indicated that more than 4 percent of patients ages 6 to 17 in Medicaid fee-for-service programs received antipsychotic drugs, compared with less than 1 percent of privately insured children and adolescents.”
We pretty much just say, “Sorry you had the misfortune to be born to poor parents; here’s a handful of drugs, now quit bothering us.” Collectively, I mean: each individual doctor may well be right in thinking that this is their best option among those available to them.
http://www.nytimes.com/2009/11/26/garden/26cousins.html?pagewanted=all
“For the most part, scientists studying the phenomenon worldwide are finding evidence that the risk of birth defects and mortality is less significant than previously thought. A widely disseminated study published in The Journal of Genetic Counseling in 2002 said that the risk of serious genetic defects like spina bifida and cystic fibrosis in the children of first cousins indeed exists but that it is rather small, 1.7 to 2.8 percentage points higher than for children of unrelated parents, who face a 3 to 4 percent risk — or about the equivalent of that in children of women giving birth in their early 40s. The study also said the risk of mortality for children of first cousins was 4.4 percentage points higher.”
The first problem is that this paragraph completely confuses the statistical issue because of the way it describes the percentages. “1.7-2.8 percentage points higher than for children of unrelated parents, who face a 3 to 4 percent risk” - now does that mean 1.7-2.8% of the 3-4% risk? In other words, low-end, 0.03 * 1.017 = 0.0305 or 3.05% to high-end 0.04 * 1.028 = 0.0411 or 4.1%?
No, probably not. But because of the way it’s stated that’s how it sounds. What they almost certainly mean is for the percentages to be added - that is, a range of 3 + 1.7 = 4.7 percent to 6.8 percent. That’s a much easier statistic to grasp and it’s easier to compare: 3-4% and 4.7-6.8%
Put that way, the quoted comment later in the article that “Even the small average risk of defects reported in the 2002 study represents nearly double the risk to children of unrelated parents” is much easier to see in the statistics.
The second problem is that an increased rate for mortality is quoted without the normal rate being given. “The study also said the risk of mortality for children of first cousins was 4.4 percentage points higher.” But what’s the normal infant mortality rate? If it’s 25%, that 4.4% doesn’t look so significant. But it’s not. The US infant mortality rate is 0.67% (6.7/1000). And here again the same problem as before comes in. Is the rate 4.4% higher than the normal rate - 0.0067 * 1.044 = 0.0070 or 0.70% - or is it, like the other statistics appear to mean, saying that the rate is 0.67 + 4.4 = 5.07 percent? I am assuming the latter - but if so, this sentence massively fails to communicate that we are talking about a mortality rate that means that a child of first cousins is 5.07 / 0.67 = 7.57 times more likely to die in infancy. Because the baseline US infant mortality rate is missing, and because the quoted increase is unclear, it’s impossible to get that piece of information from the article. But if the latter interpretation is correct, the increase in percentage terms over the baseline rate is 4.4 / 0.67 * 100 = 657%
4.4%. 657%. These are different kinds of numbers. It would be good if the article made that a little bit clearer.
http://www.nytimes.com/2009/11/25/your-money/credit-and-debit-cards/25card.html
Headline: “In Australia, Curbs on Credit Card Fees Backfired”
Actual message of story: curbs on credit card fees led to retailers transparently passing along to customers the actual additional costs of credit-card transactions.
Currently the costs of using a credit card rather than a debit card or cash are completely hidden from the customer. Everyone pays the same price even though CC customers cost the merchant more. So, cash & debit customers pay more than they really should in order to subsidize credit customers. That is the current system and it is perverse and bad for consumers.
The change to credit card fees being tacked on on top of the basic cost is a much fairer system. Don’t want to pay them? Pay cash or use a debit card.
Unless transaction costs are visible to the customer there is little pressure to reduce them. The fact is using a credit card is more expensive than using a debit card and yet the customer, the only one with the ability to choose how to pay, has that fact hidden from them.
Of course the credit card companies are screaming bloody murder over this. When you’ve had decades of slicing off fat transaction fees you’re going to do anything you can to keep them hidden.
The interesting thing about modern conservative thought is that it transformed during the 15-25 years that it predominantly held power in the US, roughly 1980-mid 2000s.
It began this period with a set of ideas that it claimed had not been tested in policy before. The claim was not that these ideas were articles of faith or allegiance, or that failure to adhere to them made you a socialist - otherwise the entire US prior to the 1970s would have to be socialist. The claim was that these ideas would produce better results in the real economy. And because they were attractive to many, and some were plausible, and many were while not new at least things that had not been tried in decades - like determined union-busting, tight controls on spending, unregulated free markets as the solution to every problem - these ideas were adopted by populist politicians promising results - not asking for a vote based on adherence to the ideas because the ideas were inherently good, but based on the idea that their performance in the real world would be good.
And they failed. In most regards, the period of conservative dominance (and even during the Clinton administration conservative ideas held sway) has been a failure compared to the previous policies that were pursued. Economic growth has been smaller, even if recessions have been fairly shallow up until this one (and a good argument can be made that this one reflects the saving-up of a lot of trouble from earlier in the conservative regime). Inequality has risen greatly. The country spent a lot of the new resources that were released from rising productivity on building mansions for the very wealthy, and very little of it on things of social usefulness, like education, reduction of poverty, scientific research, and productive economic development.
Some few conservative-leaning policies proved to be effective. The Volcker interest rate maneuver that Reagan inherited and continued was effective in halting inflation, albeit it at great and very unequal economic cost - falling most heavily on the unemployed who were out of work when investment was extremely low. That’s almost it for successes, in fact.
The list of failures is long. Tax cuts do not pay for themselves. Overseas wars are not quick and cheap. Deregulation in every industry does not result in superior performance and service. Union-busting makes it harder for workers to negotiate a fair share of commercial profit. Treating capital gains income preferentially causes inequality and leads corporate executives to make decisions that give them great personal gain at the expense of their corporation. Removal of high progressive income tax rates makes it easy for corporate executives to take money out of their corporation in income instead of reinvesting it in the business. Lack of oversight of industries leads to massive corruption and economy-wide damage like the housing collapse. Free trade agreements tend to be structured to benefit corporate interests and not workers and this unsurprisingly hurts equality. Allowing public corporations to be run as the private fiefdoms of their executives hurts investors, employees, and the economy as a whole. The list goes on and on.
Now because they failed, they had to change their line. They had to move to claims that were more qualitative and less quantitative. The things they espouse become more articles of faith than ideas with even a hint of empirical support. The claim that they would work has been tested and found to be incorrect. There is no evidence that they worked that can be brought out. So the evidence has to be ignored, and these days it often is. We don’t look at whether the conservative period was better or worse than the period preceding it, because to do so is to acknowledge that it was worse.
Policy prescriptions moved too. (In fact, Bush made at least two enormous Keynesian moves during his Presidency, and arguably three: the big tax cuts, Medicare Part D, and perhaps the wars in Iraq & Afghanistan. Now I think two of those were stupid-Keynesian because they were extremely expensive for the economic return - tax cuts mostly go to rich people and get saved, wars don’t create any lasting value. Medicare Part D was wastefully written, and amounted to a giveway to drug companies, but at least it served a useful purpose.)
This is no surprise. No political force in a democracy that attaches itself to anti-empiricism can long survive, because people like experimentation in policy - they like empiricism. In fact, empiricism marks American politics more strongly than liberalism or conservatism or any previous divides. The reason America has succeeded is because America has experimented with different policies, judged their results, and changed course accordingly. This is how America came to lead the world. Anti-empiricism, on the other hand, is almost totally discredited, to the point where it is almost too obvious to note. Prescribing policy that you proclaim to be right without also claiming that it will actually work would be an unspeakable act in politics, one that would virtually guarantee a loss in an election.
So, again, the original biggest claims - that conservative economic policy would generate higher growth and that would mean higher incomes for everyone than the alternatives, or previous policy - were empirically tested and found to be completely incorrect.
And here’s the thing: people noticed. They noticed that conservative policies failed, and they kicked out the people responsible and elected Democrats, especially that one Democrat who was always standing behind a big sign saying “Change”. Because people really don’t like big, overarching economic ideas that don’t work. And they noticed that conservative ideas don’t work. They may not know why, and so when they’re asked questions about economic subjects they don’t really understand, like the deficit or public spending, they will often say things that sound like support of conservative policies. But that’s not how they voted. They kicked the conservatives out. They noticed that their economic policies do not work.
Now when are the Democrats going to notice?
I know everyone reads Krugman anyway. But I think this is an important observation in this column: http://www.nytimes.com/2009/11/23/opinion/23krugman.html
The Obama administration is already restricting what it says and does based on the received-wisdom politics of cable news, instead of relying on the empirical effectiveness of policy as measure in the actual economy.
So Obama says, deficits are bad. We might need to cut the deficit to avoid a return to recession. But this is bad idea. It will not work. It will make things worse. That will mean millions more out of work and will result in the Democrats losing power. In the meantime it discredits what actually will work and is the best policy: spending a shitload more money right now to reduce unemployment. This is a really bad thing for a Democratic President to be saying.
Note, when we say that the stimulus bill worked but wasn’t big enough, that’s not an ideological observation. It’s based on something that virtually all economists agree on: government spending that is not funded by taxes will stimulate demand. The few that claim otherwise have to do so in the face of the success of the Keynesian measures taken first in response to the Depression and later during WWII. When the government spends more demand goes up. It doesn’t vanish anywhere else, nor would you expect it do so, nor does anyone expect it to do so, conservative or liberal.
The argument that the conservatives make is that long-run the additional debt incurred will be a drag on economic growth sometime in the future (though NOT immediately) through taxes. And again, liberal economists do not disagree with that idea - they just think that the long-term economic costs of the borrowing required are (much) smaller than the long-term economic costs of the damage to business, education, employment, and social services that will be incurred if the economy is left with demand far below capacity. This is a simple argument - it is about whether the current emergency warrants borrowing from future income. It is, a little like a household in this one way: if a flood was coming and you could spend $10,000 to prevent $100,000 in damage to your house, would you put it on your credit card? The honest conservative argument amounts to a claim that the damage will be less than we claim and the cost will be more, not that the proposed remedy of spending more money won’t fix it short-term. And, well, the damage is adding up, and that argument is looking less credible
That is, nobody seriously disagrees that a stimulus package will generate jobs - except zombie conservatives in conflict with historical fact….
And those are the guys whose concerns the President is addressing. Great.