TheJach.com

Jach's personal blog

(Largely containing a mind-dump to myselves: past, present, and future)
Current favorite quote: "Supposedly smart people are weirdly ignorant of Bayes' Rule." William B Vogt, 2010

Forms of atheism and death tolls

A common debate amongst atheists and theists: who is responsible for more deaths? Related: was Hitler an atheist or a Christian? It doesn't matter since Stalin killed more and atheists suck! A common response to that last bit: Stalin also believed the Earth rotated around the Sun; Sun-centric people are evil!

There are two major mistakes in that short characterization. (Click while viewing the full post for the singular points.) The first is a relevance error, the second is a category error. First: does it matter who is responsible for more deaths? 1.8 people still die every single second. (http://www.census.gov/population/international/data/idb/worldvitalevents.php) The better question, to me, seems: are atheists or theists more likely to reduce this atrocious death rate? The fact is, about every 2.75 years or so, we lose an equivalent to all those lost directly due to the major conflicts of the 20th century. (http://necrometrics.com/20c5m.htm) Most of those deaths in the 2.75 years are due to disease, and the "old age"-specific disease is largely the family of cardiovascular ones. This indicates that whoever can cure or stop these diseases (and old age) can do a lot for reducing the death rate.

That question's answer isn't so clear-cut, because the simpler form is more of the typical science vs. religion issue and I think most people can agree how that's gone (in science's favor if you're wondering). The confounding variable there is that doing science that is beneficial to humanity doesn't require one be an atheist. One may work incredibly hard on some HIV drug, motivated by religious concerns while using techniques that, if applied to one's own belief system, may destroy it.

See Full Post and Comments

Playing with Morton Numbers

Dimensionality is a lie... okay, it's more of an interpretation.

If you have a set of integers such that you can construct coordinate pairs (x,y) (such as the locations of the pixels on your screen), this set of pairs is said to have two dimensions. But there's no reason it can't have three: the third dimension is just always 0! (x, y, 0). And so on for any upper dimension.

What about scaling it down to 1 dimension though? Is that even possible? Turns out, yes, and it's pretty easy. Just convert each x and y to base 2, and interleave the bits such that all of x's bits are in even positions and y's bits are in odd positions. We call the resulting binary number a Morton Number.

See Full Post and Comments

I wish Python had macros, but it's okay

I love Python, I just wish it had macros so I didn't always have to use eval/exec and friends. I'm not even asking for Lisp macros! C macros would be enough. (Though I guess it's not too hard to wire Python up to use the C preprocessor or something similar.) Yet as I'll show, Python's nice enough that for most cases it can get by just fine. Look at this:


#define Q(x) ((#x)[0])
#define CH(N) if (ch == Q(N)) GPIO_WriteBit(GPIO7, GPIO_Pin_##N , GPIO_ReadBit(GPIO7, GPIO_Pin_##N ) == Bit_RESET ? Bit_SET : Bit_RESET)
CH(0);CH(1);CH(2);CH(3);CH(4);CH(5);CH(6);CH(7);


expands to (pretty printed):

See Full Post and Comments

Featured on reddit!

Cool, my FFP Machine paper got a reddit link: http://www.reddit.com/r/ECE/comments/k5yld/ffp_machine/

I didn't get that many hits from it, but still cool anyway. I didn't even notice until I looked at my analytics tonight, I guess that's a good thing. (I don't think my site would last in a real reddit crisis.) Eventually I'll get around to optimizing the site... Right now every page hits the DB, which is the main cause of downtime.

See Full Post and Comments

Clojure Tip: defstruct, deftype, defrecord

I'm currently learning Clojure, so I intend to document a few findings here that required at least a couple minutes of Googling around for me. The Clojure docs will tell you in the nitty-gritty the differences between defstruct, deftype, and defrecord, but I think an example of each is more beneficial. Also, some older examples of deftype are out of date! Trying to do things the obvious way, at least to me, resulted in a runtime error: "Expecting var, but Point is mapped to class user.Point". Anyway, enough babble, here's a working example of all three.


kevin@jachoonster ~/clojure-1.2.1 $ java -jar clojure.jar
Clojure 1.2.1
user=> (defstruct Point1 :x :y)
#'user/Point1
user=> (def p1 (struct-map Point1 :x 3 :y 4))
#'user/p1
user=> (println p1)
{:x 3, :y 4}
nil
user=> (println (:x p1))
3
nil
user=> (println (struct-map Point1 3 5))
{:x nil, :y nil, 3 5}
nil
user=>
user=> (deftype Point2 [x y]) ; actually creates a java class
user.Point2
user=> (def p2 (Point2. 8 9)) ; notice the '.'!
#'user/p2
user=> (println p2)
#<Point2 user.Point2@54083e1e>
nil
user=> (println (:x p2)) ; won't work
nil
nil
user=> (println (.x p2))
8
nil
user=>
user=> (defrecord Point3 [x y])
user.Point3
user=> (def p3 (Point3. 11 12))
#'user/p3
user=> (println p3)
#:user.Point3{:x 11, :y 12}
nil
user=> (println (:x p3)) ; works
11
nil
user=> (println (.y p3)) ; also works!
12
nil


For a handy flowchart for telling you which you should prefer (especially if you are wondering about proxy, gen-class, and reify), check out this page: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/. (The author wrote a book on Clojure.)

See Full Post and Comments

The best is the enemy of the better

Is the best your goal? Your standard? Is omniscience your goal? Your standard?

For many people, this is true, or at least they think it is. Children's television is a great way to observe a cornerstone of current thought in developmental psychology and how kids' futures may be determined by what influences them. It used to be "Everyone is special", sometimes with the added "in their own special way." Recently it has been "Just do your very best", sometimes with the added "and try try again!" I don't know the most modern phrase. There are two obvious sillinesses here: if everyone is "special", "special" loses its meaning and you might as well say everyone is Gorp. If you do your best, what makes you think trying again will produce any results if you're not improving?

The best is not my goal, nor omniscience itself, but appearances of both can provide some direction. If I had omniscience, I'd still look for something better. Where my philosophy lies is that I'm not seeking the best, merely the better. I'm not even sure there's a best. But hypothetical omniscience often serves as something I can point to showing that there is something better. Some place I can keep moving towards, cheaply, through learning.

See Full Post and Comments