10 September 2011

Incandescent bulbs and heating

One of the popular complaints about the push to ban incandescent light bulbs is that a lot of people have been relying on them for heating.  Pretending that all the heat emitted is captured for heating (probably not a good assumption--entropy can never be zero), let's do an analysis.  (Wikipedia  does a simpler version of this)

Here are the cases:

* If you're cooling the building, the more heat the bulb emits, the worse.  Period.  Better to keep the heat out of the building.  Switch to lower heat bulbs, like LED or CFC.

* If you're heating the building with energy that costs the same as electricity, i.e. a resistance heater (e.g. electric baseboard or space heater), the thermal efficiency of incandescent lightbulbs and the resistance heater are very similar and the energy use/cost are thus identical.  Light bulbs, however, burn out fairly quickly while electric heaters last a long time.

(One factor that may be important:  The room may not have a separate heater, and the light bulbs were emitting enough heat to keep it comfortable.  Switching to low-heat bulbs may undermine this, and replacing them with an appropriate heater may be more trouble than the energy saving)

* If you're heating the building with something that costs more than electricity (e.g. gasoline), the light bulb is cheaper.  You should probably think about getting a resistance heater.  (this may not be practical in all cases, e.g. on a boat at sea)

* If you're heating the building with something that costs less than electricity (basically everything except gasoline...or burning money...), then you can lower your heating bill (and environmental impact) by switching to lower heat bulbs.   Here's a nice calculator that enumerates quite a few of the cases.  In case it goes away, here are the numbers at at the time of this writing:

Energy SourceCost/MBTU
Electricity@ $0.09/kwhr$26.37
Electricity@$0.12/kwhr$35.16
Electricity@$0.046/kwhr$13.48
Natural Gas$17.38
#2 Fuel Oil$33.25
Gasoline@$3.75$41.25
Hardwood$16.66

The prices of these commodities varies a lot.  12 cents is the national average for electricity.  Puget Power charges 9 cents here in suburban Seattle.  Seattle City Light charges 4.59 cents.  (30 years ago, PP charged 3/4 cent, about what SCL charged then.  Thanks, WPPS.)

Heater efficiency is complicated.  These days, natural gas furnaces over 90% are common.  Electric heaters and light bulbs are a little higher, but not much.   Since these are the major cases we're comparing with light bulbs, we can ignore the inefficiency differences for the most part although  the calculator (and the numbers above) factor these numbers in.

Heat pumps are an interesting special case.  Because their calculated efficiency is usually higher than 100% (COP>1...it's sounds like a second law of thermodynamics violation but it's not: they're stealing the heat from elsewhere) it's a significantly better use of electricity than a light bulb or resistance heater.

Bottom line: there's really only one case where it makes sense to stick with incandescent bulbs:  where other types of heater are impractical for some reason, and incandescent bulbs provide sufficient heat to keep the room comfortable.  In all other cases, lower heat bulbs use less energy

(There may be other reasons to stick with incandescents--for example, the aesthetics may be preferred, but that's not my topic for today)

09 September 2011

Anecdotes and Generational Memory

One of the big differences between humans and other animals is that we can remember what other people tell us.  Books and their electronic counterparts allow this memory to extend not just across personal contacts, but across history itself.  But we get a lot of understanding from the stories told by our more immediate correspondents. 

I just read Paul Krugman's speech on the state of economics and was reminded of this.   Many people, including conservative economists, have a built-in bias towards certain ideas, but in the 1930s, the field of economics successfully repudiated them.  The success of this venture was such that there were no major banking crises for 60 years.  During that time, the conservatives found a narrative and strategy that fit their model, and starting in the late 70s, this began to get traction, to the point that by 1990, it was acceptable to snigger in professional conferences at the policies that had solved the depression and prevented financial panics for so long.  What was it that had changed?  The people who actually remembered the Great Depression as adults and professional economists had started to die off in large numbers.

As humans, we learn best by hearing anecdotes, told to us by trusted authorities.  These could be grandparents, valued teachers or professors, etc.  We can learn from dry, abstract writing, but it doesn't sink in as well if it doesn't connect to us in some personal way.  Anecdotal learning, even if wrong, affects us more deeply.  After about 1990, the economists who both remembered and understood the Great Depression were gone, and the new stories were about "The Great Moderation" and the failure of the Phillips Curve.  The stories were wrong, but they stuck.

There's a similar lesson to be learned from "The former Yugoslavia".   That region is made up of several ethnic groups and two major religions.   For hundreds of years, there had been almost constant small scale fighting, but Marshal Tito managed to unite the factions--with support of the Allies during WWII and the Soviet Union afterwards.  He was an authoritarian strongman and managed to suppress the strife that was boiling under the surface.  When he died in 1980, it was still simmering, but most people had learned to ignore it--and many former blood rivals were friends, neighbors and had even intermarried.  The peace lasted for almost a decade.  But there were too many stories, told by grandparents to gullible youngsters, about how that person's grandfather killed your great uncle.  Bad actors were able to exploit these hatreds, along with the economic pressures caused by a collapsing Soviet sphere of influence, to create a bad situation and attempted genocide.  Had the Tito regime lasted for another 20 years, the hatreds would have all been forgotten and Milosovic would have garnered no support.   The peace that's ensued from the NATO intervention seems to be lasting...we can hope that we'll get no more bad stories.

Thomas Kuhn pointed out that the way change happens is when somebody comes up with a good idea, it's often repudiated for quite a while.  What eventually happens is that the old conservatives who were suppressing the good idea die off, and their anecdotes and influence dies with them, and the new idea suddenly gets traction, seemingly out of nowhere.

In the case of Economics, there's something a lot more sinister at work.  The bad old ideas are being propped up not just by old conservatives, but new conservatives who have been getting tremendous funding to reject the new ideas.  The conservatives know this works, so they're arguing that "socialists" have been funding academia to promote Keynesian ideas.  Soros and Buffet (and Obama) are very, very far from socialists, and their contributions pale compared to how Koch and Scaife and others are funding Cato, AEI, the University of Chicago and more.  Same story in Climate Science: the most prominent deniers are funded by these same sources.   But they've been trying to sell the story (the Wall Street Journal seems to be their favorite publication) that the folks warning about Climate Change are only doing it because they think they'll get their latest research project funded.   The dry data all support Keynes and Hansen.    But it's easy to create anecdotes that tell a different story.

19 August 2011

Space Aliens Save the Economy!

Paul Krugman explains here how to use a fictitious threat of space aliens to save the economy.  The jist is:  the economy was saved in 1941 by an external threat that united the country and allowed the huge deficit spending, that had previously been blocked by congressional republicans, to have near universal support.  What they spent it on was actually negative social product--even less productive than Keynes example of paying people to dig a ditch and fill it up again--but they got greater than full employment by doing it.  A threat from space aliens could clearly do the same thing today.  By composing the threat appropriately, a clever fake could encourage needed infrastructure and social welfare spending.

Krugman says that this was in an old episode of the Twilight Zone (it turns out it's really from The Outer Limits), where a group of scientists faked an alien threat and tricked the world into world peace.   This is an old story, rewritten by many science fiction writers.  The first that I knew about was Arthur C Clarke's "Childhood's End", in which a benevolent alien race called the "Overlords" demonstrated that they could easily overpower any military on earth, illustrated the fraud of all religions and political and national partisans--generally with video--and convinced everybody to work together for the betterment of the world and succeeded in creating something fairly Utopian.  In the end, Clarke goes off the rails with some ESP claptrap, but it gave me an idea, and for a high school creative writing class, I wrote a version of the same idea, where a group of scientists commandeered part of the TV network to convince the world that such an invasion had taken place and to pursue world peace (VietNam was still a very active war at the time).  The "aliens" lived in zero G and could supposedly not tolerate earth's gravity or atmosphere, so they spoke over the TV in disembodied, godlike voices, destroyed military facilities, and commissioned "agents" (the conspiring scientists) to convey their wishes to the earthlings.  It wasn't a very good story (I was only about 15).  But I've never seen that episode of the Outer Limits, so I really did invent it.  (update: I just watched "The Architects of Fear" on YouTube and like Clarke, they drifted off into ESP claptrap and also a morality tale about solving your problems without trickery.  Sadly, troublemakers rarely have such morals)

The hard part would be getting real incriminating video like the "Overlords" did on the religions and partisans.  I bet the NSA could help.  Hacking the communications is clearly fairly easy, and once the "aliens" story has a little traction, unnecessary.  Homemade UAVs and cruise and ballistic missiles could convince most of the world of the reality of the alien threat, and prior to 1980 or so probably everybody, but the US intelligence community of today could probably see through it.  Again, NSA would be a good ally to have.   A real, working death ray might do the trick.

One story along this line that I did read was "Occam's Scalpel", by Theodore Sturgeon.   A brilliant but shallow businessman is convinced by a fake corpse and a story that invading aliens have been masquerading as human business leaders and intentionally polluting the atmosphere to terraform the earth in advance of their takeover--apparently the aliens need smog to live.  The shallow businessman seems to have been convinced by the fraud and when the story ends, we're thinking that with his brilliance he might be able to reverse the pollution trend.  There are, of course, lots of other stories about aliens solving our problems...perhaps the most famous is "The Day the Earth Stood Still"....klaatu barada nickto!

15 August 2011

The Most Socialist Presidents

I've been getting robocalls and push polls from various right wingers lately.  One of the standard talking points is that Obama is our most socialist president ever.  To anyone with the slightest knowledge of history and an understanding of the meaning of the word, this is an absurd claim.  Among the presidents since 1900, he's among the most pro-business.  He has done nothing to earn the term socialist.  The nearest is the new health care law--a requirement that everybody buy insurance from private companies, a few minor regulations of those companies with nothing that would prevent them from gouging, and a new exchange to give purchasers of that insurance a more convenient market.  This is pretty much a republican program: socialism for insurance companies, private enterprise for people.

Lots of other presidents are more socialist:

#1: Abraham Lincoln:  Our most socialist president ever, by far.  After the civil war, his three biggest achievements were the Homestead Act, the Transcontinental Railroads and the Land Grant Colleges.  All of these were major government incentives to stimulate growth by spending the resources he had available--giant tracts of land. Moreover, he was a supporter of workers--what we would come to call union rights.  From his first state of the union speech: 
Labor is prior to and independent of capital. Capital is only the fruit of labor and could never have existed if labor had not first existed. Labor is the superior of capital, and deserves much the higher consideration. 
In context, he makes it clear that he's including both free workers and slaves in what he calls "Labor".  Lincoln also pushed through the very first nationwide income tax, mainly to pay for the war.


 #2: FDR: I think most people are aware of the New Deal, the National Relief Agency, the WPA, and Social Security in his achievements.   In what will be news to most FDR haters, he didn't raise taxes to pay for his social programs.  Hoover had done that earlier.  FDR did eventually raise taxes, to pay for the war. 

#3: Lyndon Johnson was a brilliant political strategist and infighter.  He skillfully exploited a widely held sense of fairness, the worship of the martyred President Kennedy and the philosophy of government defined by FDR to push through the programs of the Great Society: expansion of Social Security, creation of Medicare, and the implementation of Civil Rights that FDR and Ike had started.   He was cornered by Goldwater, very much against his will, into allowing the Viet Nam war to expand.  His full throated support of civil rights transformed the South into a permanent stronghold for Republicans to this day, and their unthinking hatred of him has given the forces that would like to destroy his and FDR's legacy a far stronger hand than they would otherwise have.

#4: Theodore Roosevelt was simultaneously very pro business and very socialist.  He understood the need for public institutions, creating the National Park system, and boosting anti-monopoly regulation.

#5: Dwight Eisenhower ranks fairly highly because of one thing: The national interstate highway system.  He also did the first real civil rights enforcement and created NASA.

#6: Woodrow Wilson: not initially a supporter, he signed the constitutional amendment (pushed for by his predecessor Taft) that allowed a peace time income tax because he understood its necessity in the face of rising social needs and the realization that war was soon coming.

#7: Richard Nixon: Our most fervently anti-communist president also instituted wage and price controls, took us off the gold standard, created the EPA, OSHA and several other agencies.  He famously repeated Milton Friedman's line "we're all Keynesians now", a statement that was interpreted (wrongly) as supporting socialism.  And he went to China.    The price controls proved a disaster economically, as did his war policy, but otherwise, most of this stuff worked.

#8: Thomas Jefferson ignored the advice of his economic advisers and bought "Louisiana" from the French, at what was then a terribly high cost.  He quickly created expansionist programs to explore and settle it.  One of these many socialist contributions was "The National Road", the first government funded highway.  It still exists: it's called US Highway 40 and goes from Frederick, MD to St Louis, although Jefferson only planned to reach the Ohio River.  Today, the route is largely shared with I-70.

James Polk, Grover Cleveland, William Howard Taft, and Harry Truman all did things which today would be described as socialist.  Reagan, GHW Bush and many others things that would cause them to be ranked in the same general range of socialism Obama.  Did you know that Reagan raised taxes and increased government spending? And also:  "...where free unions and collective bargaining are forbidden, freedom is lost." Ronald Reagan, Labor Day 1980 (while running for president)

I'd rank Obama at about #15 or so on the socialist spectrum.  He did push for a slightly more socialist health care program than we got, but he caved to give us a program similar to the ones Dole and others were pushing for in 1993.   He undermined the already too-weak ARRA stimulus bill by filling it with tax cuts, as well as caving on tax cuts for the rich as he promised in the fall of 2010.  He gave up pushing stimulus and began pushing austerity before the 2010 election.

There definitely are more conservative presidents than Obama: GW Bush, Herbert Hoover, Warren Harding.  Note that history (including some pretty conservative historians) also rank these as having been among our worst presidents.

28 July 2011

Reinventing and Glue

Engineers are prone to something called NIH--Not Invented Here--because that is what engineers like to do: figure out how to do something and implement it.  They'd like to "Reinvent the world".  That's hyperbole, of course, but it's a tendency that their managers try to get them to resist:  If somebody has already done it, the current team doesn't need to do any new work and chances are good that the previous, ostensibly successful implementers, did a better job than the current team would.  By and large, this is good advice.  But not always.

A lot of the time, the old implementation doesn't quite exactly do what the new one needs to.  To repurpose the old work, we have to invent a new interface, to be able to fit it into the new work.  In software, we call that "glue code", or just "glue".    It's rare that glue is simple.  If the old work was well designed and modularized, it's at least a few lines of code.  It's usually quite a lot more than that, and surprisingly often, it turns out to be more than the code that's being reused.   The code that's being reused doesn't have to be tested, says management.  Perhaps, but the glue does have to be tested just as hard, and since the fit isn't perfect, the old code does have to be tested.  Suppose the old component was 2000 lines long.  If the glue is anything up to, say, 300 lines or so and the function really is similar, it's probably worth trying to make the glue work.  But if the glue is more than a thousand lines, you're really getting into diminishing returns.  It's very likely that reinventing the thing from scratch will work better for the new application, and even if it's 2000 lines long, you've eliminated the need for glue, saving a thousand lines and a bunch of testing.

There are other cases too: sometimes the old implementation wasn't all that well done.  Fred Brooks, in The Mythical Man Month, talks about second systems syndrome.  When doing the first implementation, it's all they could do to get it to work at all, and they likely were changing algorithms and interfaces all along.  It's quite likely the first implementation is kludgey and not too good.  The second time, they know better, but now they have a whole bunch of new ideas and they get a whole lot of bloat.  On the third try, they're getting closer to the Goldilocks point: not too big nor too little, refined, shaken down, appropriate algorithms, well thought out interfaces.   If the code you're trying to reuse is a first or second implementation, it's very likely you're just propagating a bad thing.

Finally, there are a lot of things that are more appropriate being reimplemented.  For example, simple searches or insertions that occur at user time.   This is such a simple algorithm that nearly everyone who has written the code has done it several times, and won't get it wrong.   A new implementation will fit the new codebase perfectly and avoid any mingled source-tree complications.  Even if uses totally naive algorithms, it's often better to be simple than optimal, and it's likely that there's no actual algorithmic advantage to be gained (e.g: a bubble sort is so much simpler that it's actually faster than NlogN sorts if there are fewer than a dozen or so things to be sorted)

23 July 2011

Debt Limit

Suppose you're someone who needs their car for their job--a traveling salesman, for example.  Your predecessor has run up ridiculous debts and left the scene.  It wasn't your fault, but you're now left holding the bag and you must deal with the situation.  One of the changes your predecessor made was to cut your hours worked, hence your income. The credit company has been on your case for months, and now they've announced that they'll send out the collection agency to take your car on August 2nd.

You've got a number of people giving you advice:

Nancy and Harry say you need to buckle down and work more hours, and do what you can to pay off at least part of the debt.

Michelle says the collection agency thing is an empty threat that you can safely ignore.

Eric and John, who incidentally were a big part of the spending spree, and have been whispering that it was you who really caused the problem even though you weren't even with the company when most of it happened, say you need to cut way back on spending, including maintenance of the car, your advertising budget, and canceling your health care.  You must not work more hours--in fact, you should work fewer.  This is so important to them that they'll willingly bankrupt the company to keep their mid-day tee times.

Barry says you need to both cut back on spending (but not anything that affects income or long term sustainability) and work more hours.

Which advice should you take?

22 July 2011

Display Resolution and Aspect Ratio

In 1994, the "Digital HDTV Grand Alliance" decided upon a new television standard for the whole world.  They specified a list of resolutions, most of which have an aspect ratio of 16x9.  They chose to allow various aspect ratios for individual pixels, and they did not specify any resolutions past 1920x1080.  These definitions were hugely counterproductive, not just for the TV industry but also for the then rapidly growing personal computer industry, as well as being confusing for most users, and completely, utterly, unnecessary.

Between the invention of moving pictures and about 1960, nearly all video had an aspect ratio of 4x3. There was good reason for this: Many things in our environment, from buildings, to sporting events and conversation groups, fit well in the 4x3 frame.   When television came along, the movie business felt threatened and in their effort to come up with a more immersive experience, they invented wider aspect ratios.  Because of the Cathode Ray Tube display technology in use at the time, TV could not duplicate this.  Many movies, but by no means all, embraced the new mode and placed subjects wide apart in the frame.   When those movies came to be displayed on 4x3 screens, the incompatibilities were addressed with two bad options:  "Pan and Scan", which loses the width of the widescreen cinematography, and "Letterbox", which uses only a small part of the screen to show the whole picture, but in a much reduced window.  The movie people were understandably upset by damage done to their cinematography...a problem which was entirely of their own creation.

When digital TV became possible, the same people saw a way out of the box into which they'd painted themselves: they'd make the new TVs support widescreen.  These same people managed to dominate the conversation.  Never mind that movies are only a small part of TV content and that 4x3 worked very well for almost everything else.  Never mind that the new digital technology made it trivial and transparent to support any resolution you chose to transmit in.  They knew analog TV hardware and movies, and made a standard with that mindset and only the next 5 years or so in mind.  They didn't understand Moore's law, or really anything about computers at all, even those these were central to what they were doing.

What they should have done was standardize two things:  the digital data format and square pixels.  Period.   They should specifically NOT have specified resolution. If I want to watch a lot of movies, I'll buy a display with a wide aspect ratio.  If I'm a sportsfan or TV news addict, I'll buy a display with a low aspect ratio.   If I want to do the other once in a while, I'll suffer in just exactly the way I have been for movies.  But it'll be MY choice, and I'll choose the style that serves me best.  The technology to adapt easily is a necessary part of every digital TV display (and personal computer).  There's no need to standardize.

The free market is a powerful thing.    When higher resolution displays become available, the market will decide which resolutions to sell, not some committee that's stuck in the mistakes they made in the 1950s.  The software and hardware to adapt content to match the display (it's called stretching and cropping) is a necessary part of every digital TV and computer display controller.  Plugging in a different set of numbers is simple.  Adapting content resolution to style, cost and availability of the necessary bandwidth is equally simple.   If half the country is watching the superbowl or some major movie, it makes sense to use a lot of bandwidth.  If I'm watching a talking head discuss current events, I don't mind if my picture is being transmitted at 320x240.  Save the money the bandwidth costs. 

It turns out that most people have a hard time understanding resolution and aspect ratio.  I'm not sure why this simple thing should be so hard, but it is.  But because the HD Alliance chose to provide for both 1:1 and 3:4 pixels, they dramatically increased the confusion.  When 4x3 content with 1:1 pixels appear, a great many TVs stretch it to wide aspect ratio, so as to fill the screen--distorting the picture.  Moreover, the manufacturers tend to bury the necessary mode controls--I suppose because usability testing found them confusing, and consequently amazingly many people have gotten so used to watching distorted pictures they've stopped noticing.    By simply standardizing on 1:1 pixels, the TV could automatically adapt.  No user controls would be necessary.  Instead, we have various and confusing "wide" "panorama", "4x3", "Zoom", etc.,  modes.

HD aspect ratio sickness has infected computers, too.  In 2003 I bought a laptop with a 1400x1050 (so called SXGA+) display surface.  Today, it's fairly challenging to find a laptop with a vertical resolution higher than 768, 73% the size of that 8 year old computer.  This is because the market for display surfaces is completely dominated by the TV business--just as in the days of CRTs--and most small TVs are 1280x720.   You can buy a monitor with much higher resolution: up to 2560x1600, but even finding out what the resolution of most display surfaces is from the marketing literature or salescritter is surprisingly difficult.  I care MUCH less how big it is in inches,  than I do how much VERTICAL resolution it has.  Nearly all applications and websites have wide menu bands across the top and bottom, dramatically reducing the space available (the window I'm using to type this subtracts 350 pixels from the top of my window and 160 from the bottom--leaving only 258 pixels of usable space on a 768 high monitor.  Windows 7 live photo gallery (the app that provoked this flame) steals 200 pixels from the top and 95 from the bottom when in editing mode, 38%.  what could be more important in a photo app than being able to get the picture as big as possible?)