Tuesday, May 31, 2011

A Small Hack

I wrote this toy program to help my daughter with a science project. She ended up not using it but I think the output looks cool. It requires gruff, IMagick, and RMagick to run. Though it contains variables that have to be edited to alter the output, I think the names are clear enough that you can see what they do. The language is Ruby if that's not obvious. I apologize for the lack of indentation, I guess you lose formatting information when you cut and paste from TextEdit.


require 'rubygems'
require 'gruff'
if argv[0] == nil
number_of_runs = 100000
else
number_or_runs = argv[0]
flips_per_run = 10
bias_factor = 0
flips = Array.new(flips_per_run,0)
run_results = Array.new(flips_per_run + 1,0)
(1..number_of_runs).each do
flips.each_index do |i|
if (rand + bias_factor) > 0.5
flips[i] = 1
else
flips[i] = 0
end
end
run_results[flips.count(1)] = run_results[flips.count(1)] + 1
end

flips_per_run.downto(0) do |size|
run_results.each_index do |index|
if run_results[index] / (number_of_runs/flips_per_run)>= size then
print "*"
else
print " "
end
end
print "\n"
end
run_results.each_index{ |i| print run_results[i]," "}
print "\n"
g = Gruff::Line.new
g.title = "Data for " + number_of_runs.to_s + " Runs of " + flips_per_run.to_s + " Flips"
if flips_per_run < 50
label_hash = Hash.new
(0..flips_per_run).each { |i| label_hash[i] = i.to_s}
g.labels = label_hash
end
g.data("Number of runs with x heads",run_results)
g.write("penny_graph.png")
print "\n"

Monday, May 16, 2011

Unlikely things

I like speculation about the future. I even like optimistic technological fantasies, but I think that they can be destructive when people don't realize that they are fantasies. Things that I won't hold my breath for, though some might happen in the far future.

1. Easy life extension

2. Mind uploading

3. Cheap, plentiful alternative energy for automobiles

4. Extensive human presence in space

5. The cure for cancer, as opposed to better treatments for some cancers

6. FTL of any sort, including sorts that don't contradict general relativity.

Monday, May 9, 2011

Could Narnia be bad for kids?

Narnia is a lovely fantasy world and the tales told of Narnia are often tales of moral redemption.
How could it be bad? The problem I see is that the Narnia tales present escaping into another world as natural and healthy. While this is true to an extent, ultimately one finds or fails to solutions to one's troubles in the real world. Shouldn't kids be taught that.

Saturday, May 7, 2011

Speculations -- No Jesus

If the Christian religion had never existed, what would be the cultural consequences. Here are my guesses.

1. Europe and America would still be religious but a mix of faiths might have survived the fall of Rome. Manichean and Mithrasist temples might dot the land. Paganism might not have died out but it would still have had to evolve, becoming less magical and more mystical. On the other hand, if Europe wasn't united under one religion, Islam might have conquered Western Europe.

2. There might be less interest in equality. Christianity, early on, stressed equality between ethnic groups. "No Jew or Greek, no slave or free." While the New Testament is silent on slavery and suggests that women should be subject to their husbands in spiritual matters, Christianity is still firm on the idea your capacity for salvation doesn't depend on things like martial prowess or social status. From these ideas of metaphysical equality, ideas of equality in this world could readily spring.

3. The conquest of the new world might have been somewhat less aggressive if Europeans did not have the fig leaf of one true religion to hide their greed behind.

4. There might be less science and technology. Monotheism leads readily to the idea of universal natural laws. If natural forces were seen as operating according to there own whims rather than ordered by one God, our understanding of them might not have advanced as much as it has. Some things, such as probability theory could advance through analysis alone, but the idea of finding out natures regularities through observation and experiment might not have gotten off the ground as quickly.

5. Sexual morality would be affected but it's impossible to say how. Christianity, despite it's demand for monogamy and hetrosexuality, is hardly the only tradition that restricts sexual behavior.

Thursday, May 5, 2011

Husband's Worries

My husband worries that paying our oldest daughter to read classics, as he has, will harm her intrinsic motivation to read. I think this is true but I am glad she did read those books. Because of that she is aware of aspects of human experience most nine year olds would not be. I don't think she can fully appreciate them, but I think parents never see the depths of their children, especially the darker depths which children keep hidden out of prudence.

Something Blindingly Obvious

Single payer health care would make US middle-aged workers more employable by removing a major cost of employing such people.

Monday, May 2, 2011

Old Man's War

I really liked John Scalzi's Old Man's War. As a piece of genre fiction it had many enjoyable features. The soldier's in the book were, for the most part, intelligent, likable, people who tried to survive as best they could in a horrible situation. Unlike Heinlein, Scalzi doesn't write all-wise father figures or attempt to teach political lessons to the reader.

Scalzi also didn't spend a lot of ink showing off his technical knowledge to the reader. I probably like technical speculation more than the average SF reader does, but it can get in the way of telling a good story. I did think the green soldiers were a bit silly, but I don't know if would bother most people.

I could have wished for more interesting aliens. The bit about eating humans got old after a while, but the mysterious Consu were genuinely frightening.

All in all, Old Man's War, isn't mind blowing but entertains without visibly showing off or insulting the reader's intelligence.