Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Why equation evolution and religion is wrong

Be it evo­lu­tion in gen­er­al, mi­cro-evo­lu­tion or macro-evo­lu­tion.

Let's start with Ger­vase's three points:

  • It's a ba­sic po­si­­tion that you hold about the na­­ture of re­al­i­­ty that's not prov­able - it's a faith po­si­­tion.

  • It's some­thing that you put your trust in, and live your life on the ba­­sis of.

  • It's some­thing you urge oth­­ers to be­lieve as the truth.

Per­haps the third ap­plies to evo­lu­tion, The oth­er two are garbage.

Let's start with the first one. There's this nifty con­cept called fal­si­fi­a­bil­i­ty (sor­ry about the spelling). Some­thing is fal­si­fi­able if it can be proven false.

Things that are un­fal­si­fi­able are not apt for ra­tio­nal dis­cus­sion, since the truth val­ue be­hind the propo­si­tion is un­know­able.

Here's an ex­am­ple of some­thing that's un­fal­si­fi­able: there is a supreme be­ing that com­mands the whole uni­verse, yet is not part of it, and can not be con­tact­ed.

Here's some­thing that's not: ran­dom mu­ta­tions get se­lect­ed by the en­vi­ron­ment to pros­per.

That is, be­cause it can be proven false. If there were no mu­ta­tion­s, it would be false. If ex­pos­ing difer­ent breeds to en­vi­ron­ments caus­es no dif­fer­en­tial in sur­vival rate, it is proven false.

Yes, this is the mi­cro-evo­lu­tion Ger­vase ac­cept­s. Macro-evo­lu­tion sim­ply ex­trap­o­lates from this gen­er­al­ly ac­cept­ed the­o­ry in­to a larg­er one. Is it the right one? Not sure.

There is no imag­in­able ex­per­i­ment that can prove the in­ex­is­tence of god. That's why god's ex­is­tence is a re­li­gious mat­ter, and not a sci­en­tif­ic one. The ex­is­tence of mi­croevo­lu­tion can be seen, and even ex­per­i­ment­ed (ask any guy that hap­pens to have a few hun­dred fruit flies in a bot­tle).

As for macroevo­lu­tion, well, as mpyne says, there is a thnk­able ex­per­i­men­t. And even if it is­n't tech­ni­cal­ly fea­si­ble, there can be a ra­tio­nal dis­cus­sion, re­gard­ing the re­com­bi­na­tion spped­s, and ra­di­a­tion lev­els pro­duc­ing mu­ta­tion­s, and vol­umes, and timescales.

So, dis­cussing it is a ra­tio­nal process.

As for the sec­ond point: I doubt any­one lives his life based on evo­lu­tion, al­though it can pro­vide some rea­son­able tips about how to ex­pect things to hap­pen, but that's most­ly rea­son­ing by anal­o­gy.

Now re­li­gion.. one of its pur­pos­es is usu­al­ly to de­scribe how you should live.

So, what Ger­vase is de­scrib­ing is re­li­gion. And by his def­i­ni­tion, evo­lu­tion ain't.

Evo­lu­tion the­o­ry may be wrong. That's ok. It hap­pens to al­most all the­o­ries in one way or an­oth­er, usu­al­ly they end re­placed by a slight­ly evolved new ver­sion.

But re­li­gion? Well, dude, that's just an­oth­er name for who the hell knows. If you ac­cept re­li­gion as a premise, you are in­to voodoo land.

Maybe the uni­verse on­ly ex­ists since 1987, and ev­ery­thing ear­li­er is a thought in god's mind. Who knows? Pre­summably on­ly him.

Maybe he's cranky and we all die and go to hell to­mor­row. He's many things but not rea­son­able, as ev­i­denced by his al­leged handy­work.

So, what's the point in ar­gu­ing a sub­ject where no ra­tio­nal dis­course is ap­propi­ate, a sub­ject which is the very ba­sis of ir­ra­tional dis­course?

I have no idea. That's why I'm an ag­nos­tic.

Games using PyQt

As some may re­mem­ber, a long time ago I start­ed writ­ing a Be­jew­eled! looka­like us­ing PyQt.

While that game is ac­tu­al­ly playable, it most­ly showed me I had no idea how to write a de­cent game ;-)

So, I have been for a cou­ple of weeks try­ing to cre­ate a high lev­el pack­age for cre­at­ing games, specif­i­cal­ly board games (yes, I clas­si­fy Be­jew­eled as a board game).

Well, it's work­ing. I am writ­ing a few li­braries, and I am writ­ing three games us­ing it.

  • Scroogle: a dumb bog­­gle/scrab­ble mix­­ture

  • Name­­less1: The be­­jew­­eled clone

  • Name­­less2: A crafty-­­com­­pat­i­ble chess­board

Since I have ab­stract­ed stuff like pieces, squares, and such, these games are quite small in size, which means easy to im­ple­men­t!

For ex­am­ple, scroogle can keep score, use a dic­tio­nary for word val­i­da­tion, re­place used tiles with new ones, so it's ba­si­cal­ly com­plete.

It's un­der 200 lines of code.

The chess game is, again, al­most com­plete, ex­cept for stuff like sav­ing games, or board edi­tion, but you can play ( it can't tell if you win or lose and has no timer, though ;-)

It's 210 lines of code (the crafty in­ter­face is 70).

Why am I men­tion­ing this? Well, I think that if I ev­er make this good enough to re­lease it, de­vel­op­ing sim­ple games for KDE will be­come much eas­i­er.

And those games will be a 80KB down­load, in­clud­ing art.

That would be good, would­n't it? But...

... if you are think­ing of writ­ing a game, I need your help. I want you to try us­ing this, so I can fig­ure out if it's good or how it should be changed!

Please con­tact me if you know a lit­tle PyQt and want to write games!

I don't have a feminine side. And neither do you, girlie man!

Yes­ter­day I was talk­ing with Rosar­i­o, and we had a strange ar­gu­men­t. She said I was not in touch with my fem­i­nine side, and that she did­n't like that.

To which I replied I don't have a fem­i­nine side.

Of course that caused a re­ply of "y­ou do, but you are not in touch with it" and what­ev­er. I asked her what my fem­i­nine side is sup­posed to be, and she men­tioned that it was the part of me where I could find my feel­ings and some oth­er things.

To that, I say, nyah nyah!

The idea that just be­cause I have a cer­tain kind of chro­mo­somes, in or­der to find my feel­ings I must have a side that's "fem­i­nine", I say that's just pro­pa­gan­da.

I am a guy. I am mas­cu­line. I cry when­ev­er I watch the end of For­rest Gump, The part of me that's cry­ing is not some fem­i­nine side. It's my mas­cu­line side. I cry mas­cu­line tears, be­cause a movie trig­gers some re­sponse in my very mas­cu­line feel­ings.

If I were to tell a wom­an that she has to get in touch with her mas­cu­line side so she can, say, drive a car bet­ter, I would be called a chau­vin­ist pig. And cor­rect­ly.

The idea, I sup­pose, is that her fem­i­nine side can drive just fine. Well, my mas­cu­line side can cry on movies, and fall in love, and miss my mom, and pet my cat just fine, thank you very much.

So, I don't have a fem­i­nine side Rosar­i­o, it's just my oth­er mas­cu­line side, and he loves you too.

This is why dynamic languages are cool

I wrote a lit­tle spread­sheet thingie a few days ago. [1]

Of course, it's a toy, not the re­al thing at al­l, but it was a nice hack, since it is a re­al, re­cal­cu­lat­ing, ex­ten­si­ble, de­pen­den­cy-check­ing, loop-avoid­ing spread­sheet en­gine in about 50 lines of code.

That's be­cause I was us­ing Python, which is a se­ri­ous­ly cool lan­guage to write that kind of thing in, since all you have to do to eval­u­ate an ex­pres­sion is call eval() on it.

Sure, that's nice, but the re­al core of the spread­sheet en­gine was that you could al­so cre­ate a dic­tio­nary-­like ob­ject that re­cal­cu­lat­ed on-de­mand its con­tents.

That way, when you ask for sheet['a1'], cus­tom code goes to see what a1 has in it (a for­mu­la), cal­cu­lates it if need­ed, and maybe trig­ger a few ex­tra re­cal­cu­la­tions if an­oth­er cell de­pends on a1. [2]

But as any­one who us­es spread­sheets can tell you, weird things ex­ist in ssheet land.

For ex­am­ple, if you copy some­thing, then you paste it, it gets mod­i­fied in the process.

What oth­er app does that???

Here's an ex­am­ple you can check in any spread­sheet:

  • In A1, type "1".

  • In B1, type "A1+1" (should dis­­­play 2)

  • In A2, type 2

  • Copy B1 to B2, and it will dis­­­play 3

Fur­ther, if you look at the for­mu­la in B2, it says A2+1 now.

That's called rel­a­tive cell­names (I think).

In or­der to do that trick, you have to parse the for­mu­la in B1, and then, when you paste it in­to B2, take in­to ac­count the dis­place­ment and mod­i­fy ac­cord­ing­ly. Usu­al­ly, if you want ab­so­lute names, you use $ A1 in­stead, and that would stay un­mod­i­fied.

Now, that throws a nice mon­key­wrench in­to my neat lit­tle spread­sheet [3] be­cause now it sud­den­ly looks not like a spread­sheet at al­l!

So, I start­ed think­ing, how the hell could this be done? The whole ad­van­tage of a python sheet is us­ing eval(), so switch­ing to a pars­er (like if this were a C[++] sheet) would be sil­ly.

I delved in­to the python stan­dard lib. As ev­ery python pro­gram­mer knows, al­most ev­ery­ht­ing is there. If you write python, you read the li­brary ref­er­ence ev­ery day, and mem­o­rize chunks of it, be­cause it's one of the things that make python cool. It's just chock­full of use­ful stuff!

And here I was read­ing about the com­pil­er mod­ule, and the pars­er mod­ule, which can be used to do won­drous stuff with python code. But I could­n't un­der­stand jack­shit about them. I'm a sim­ple coder.

And just as I was go­ing to say, let's write in­stead about the con­nec­tion be­tween free soft­ware and the sex life of frogs [4] I found to­k­enize.

To­k­enize is a mod­ule that pars­es python and turns it in­to to­ken­s. Here's how a+2 looks af­ter you to­k­enize it:

1,0-1,1:        NAME    'a'
1,1-1,2:        OP      '+'
1,2-1,3:        NUMBER  '2'
2,0-2,0:        ENDMARKER       ''

The num­bers on the left side are po­si­tions in the text stream where the to­kens were.

It has just enough in­for­ma­tion that you can to­k­enize a piece of code, and then re­assem­ble it. There's code to do just that, it's called re­gur­gi­tate and it's writ­ten by Ka-Ping Yee.

So, the so­lu­tion is ob­vi­ous. When copy­ing a for­mu­la:

  • To­k­­enize the for­­mu­la to be copied

  • Look for to­kens of type NAME

  • See if it looks like a cel­l­­name, or _cel­l­­name

  • If it's _cel­l­­name, leave as is. That will be our no­­ta­­tion for ab­­so­­lute cells

  • If it's cel­l­­name, dis­­­place it nice­­ly

  • Re­gur­gi­­tate it

Lat­er, when eval­u­at­ing a for­mu­la, if some­one asks for cell _a1 give him cell a1.

And voilà, rel­a­tive cell­s.

This work­s, and it works well (ok, I had to in­tro­duce some ug­ly glob­al­s, I need to learn more stuff), and it is guar­an­teed to to­k­enize in the same way python does it. It's not even re­al­ly slow [5]

I touched a bunch of oth­er things, in­clud­ing sup­port for all the func­tions in python's math mod­ule so you can use them in cell­s. Here's the code to do that:

for name in dir(math):
        if name[0]<>"_":
                self.tools[name]=eval('math.'+name)

Freaky stuff, is­n't it?

What's the main is­sue? Per­for­mance. To put it sim­ply, I se­ri­ous­ly doubt a sheet writ­ten in python can be fast enough for gen­er­al use. But hey, it's ex­ten­si­ble, it's nice, and de­pend­ing on what you are try­ing to do, it may be good enough.

And here's to­day's ver­sion of Stupid­Sheet in­clud­ing rel­a­tive cell­s. Don't wor­ry, it's a small down­load ;-)


Contents © 2000-2023 Roberto Alsina