0688: "Self-Description"

This forum is for the individual discussion thread that goes with each new comic.

Moderators: Magistrates, Prelates, Moderators General

Re: "Self-Description" Discussion

Postby synthesis77 » Thu Jan 14, 2010 12:23 am UTC

sticksmite wrote:
synthesis77 wrote:
Splarka wrote:When is "This sentence is spoken with [0-9]* syllables" true?

Registered just to answer this!
"This sentence is spoken with syllables"

Ah, you tricky guy. Change it to [0-9]+ for your regex gurus.

"This sentence is spoken with 014 syllables" (for those who pronounce it "zero")
"This sentence is spoken with 013 syllables" (for those who pronounce it "oh")
0016(zero)/0014(oh), 00018/00015, etc...

Still like the original solution better... ;)
synthesis77
 
Posts: 2
Joined: Wed Jan 13, 2010 10:15 pm UTC

Re: "Self-Description" Discussion

Postby gravityhomer » Thu Jan 14, 2010 12:35 am UTC

The first panel is the only to contain independent content and the other panels depend on it. I'd like to see how panel 2 varies on every version of panel 1. At one point the bar height for 1 and perhaps even 3 will exceed 2.

wait scratch that, I read "image" in panel 1 to be the actual circle, in which case I thought that was pretty funny, but now I see that "image" means all three panels. Wow, that is cool.
gravityhomer
 
Posts: 5
Joined: Wed Feb 04, 2009 3:34 am UTC

Re: "Self-Description" Discussion

Postby phlip » Thu Jan 14, 2010 1:08 am UTC

sticksmite wrote:I agree that panel 2 needs to be changed. It could be a percentage of black ink by panel and be correct.

As it stands, if it's just the true amount by panel, the node for panel 2 wouldn't (always) have a loop. This is the case iff you add the black to the top of bar 2 in panel 2 because in that case it would not require a further update to its own panel (meaning no loop).

If it were a percentage, then an addition to the top of bar 2 in panel 2 would require a slight decrease in the height of bars 1 and 3. That's the only way I see the node for panel 2 always having a loop.

Panel 2 does have a loop - if you change the height of either bars 1 or 3, for instance, then panel 2 now has a different amount of ink in it, and bar 2 would have to be updated too.

More to the point, if you change something outside the graphs in any of the three panels (say, the labels) then all three graphs will become incorrect as a result, and need to be updated.

As to your specific example... if the comic was in equlibirium, and all the graphs were correct, and you were to go in and increase the height of the second bar in that panel... then you're right, the amount of black ink in panel 2 has gone up, so the bar should rise... but it should rise by less than the amount of black ink that was actually added. So it would still require a further update to reduce the second bar back towards where it originally was. Which will again reduce the "correct" value, so it'll have to be reduced again... and it'll eventually settle back to the same equilibrium position it was already in.

The only thing wrong with the graph in panel 2 is the lack of vertical scale markings, but even then, the relative heights are correct (consistent with the vertical scale being such that the top of the graph says the respective panel is 16% black).
While no one overhear you quickly tell me not cow cow.
but how about watch phone?
User avatar
phlip
Restorer of Worlds
 
Posts: 7087
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia

Re: "Self-Description" Discussion

Postby SocialSceneRepairman » Thu Jan 14, 2010 1:56 am UTC

clanders wrote:I registered on this forum, a somewhat laborious process, simply so I could say that this comic might be the worst xkcd comic ever. And it has some competition.


Remember, folks, our anti-fans come from the group of people who consider registering on a standard phpbb forum to be "a somewhat laborious process."

...well, there exists an anti-fan who does.
SocialSceneRepairman
 
Posts: 200
Joined: Sat May 24, 2008 4:17 am UTC

Re: "Self-Description" Discussion

Postby Pfhorrest » Thu Jan 14, 2010 1:59 am UTC

happysteve wrote:Ah, reminds me of this...

How many letters are in the ANSWER to this question?

Just a few of the correct responses:
0
Four
Exactly ten
42: it's the answer to life, the universe, and everything.


I've always preferred, much more simply, "What is the answer to this question?"

My favorite answer is "This is the answer to that question."
Forrest Cameranesi, Geek of All Trades
"I am Sam. Sam I am. I do not like trolls, flames, or spam."
The Codex Quaerendae (my philosophy) - The Chronicles of Quelouva (my fiction)
User avatar
Pfhorrest
 
Posts: 2112
Joined: Fri Oct 30, 2009 6:11 am UTC

Re: "Self-Description" Discussion

Postby ihope127 » Thu Jan 14, 2010 2:01 am UTC

Dude, guys. Suppose you had to solve the following system of linear equations:

x = 0.2x + 0.3y + 0.4z + 5
y = 0.1x + 0.2y + 0.6z + 13
z = 0.4x + 0.1y + 0.1z + 4

Would you pick arbitrary values for x, y, and z, and then repeatedly apply all three equations as if they were assignments, and try to determine the limit as the number of repetitions approaches infinity? I would not.
There is a significant chance that an artificial intelligence created within the next few decades will not value humanity and therefore will treat us as we treat animals. It would be awesome if xkcd mentioned this.
----
Find me on freenode as uorygl.
ihope127
 
Posts: 66
Joined: Mon Jul 30, 2007 3:59 am UTC
Location: 127.0.0.1

Re: "Self-Description" Discussion

Postby Pfhorrest » Thu Jan 14, 2010 2:16 am UTC

NikolaiSmith wrote:It occurs to me that this may be the first forum thread in the history of web comics where a reader could have posted the word, "First!" as the first posting and it would have been both topical and witty.

Perhaps that's why it didn't happen.


This is not the first post. It is topical, inasmuch as it is self-referential (including this parenthetical statement and the comma-delimited parenthetical statement containing it), yet in all probability it is not witty, as it is merely a derivative of the witty post suggested by the post to which it is a reply, and furthermore, because this sentence has run on too long.
Forrest Cameranesi, Geek of All Trades
"I am Sam. Sam I am. I do not like trolls, flames, or spam."
The Codex Quaerendae (my philosophy) - The Chronicles of Quelouva (my fiction)
User avatar
Pfhorrest
 
Posts: 2112
Joined: Fri Oct 30, 2009 6:11 am UTC

Re: "Self-Description" Discussion

Postby Iridos » Thu Jan 14, 2010 3:20 am UTC

Well, so who's going to write a program to produce this graph? Seems to me this would be a nice exercise... Of course you should use vector graphics, so the graph can be scaled at will ...
Will the program allow to scale the pie-chart and bar-graph in the 1st 2 panels? Will you be allowed to pick a font and font-size?

NikolaiSmith wrote:It occurs to me that this may be the first forum thread in the history of web comics where a reader could have posted the word, "First!" as the first posting and it would have been both topical and witty.

Perhaps that's why it didn't happen.


As to a) - I bow to you, this was really eye-opening, also, you really got me laughing
In regard to b) I fully agree with the analysis - that _must_ be the reason, as people posting "First!" are generally neither very topical nor witty.

synthesis77 wrote:
Splarka wrote:When is "This sentence is spoken with [0-9]* syllables" true?


Registered just to answer this!

"This sentence is spoken with syllables"


... this was my first thought as well - that's really the obvious answer :)
(Specially considering that regexps are non-greedy by default!)

sticksmite wrote:Ah, you tricky guy. Change it to [0-9]+ for your regex gurus.


Hmm... is that supposed to be a basic or an extended regexp?
"This sentence is spoken with 9+ syllables "?

Or... aww, you mean the original poster meant it to be a glob? He should have said!

In this case I'll offer:
This sentence is spoken with 2 of my very own lips - and still, it merely consists of syllables.
This sentence is spoken with 4 times as much food in my mouth than I ever tried speaking with before - I wonder if you can still make out any syllables.


I.


Edit: (took too long, several new posts in between, also, this is getting too long - will put in separate post)
Last edited by Iridos on Thu Jan 14, 2010 7:38 am UTC, edited 2 times in total.
User avatar
Iridos
 
Posts: 80
Joined: Wed Jan 28, 2009 6:58 am UTC

Re: "Self-Description" Discussion

Postby RockoTDF » Thu Jan 14, 2010 4:38 am UTC

nehpest wrote:
RockoTDF wrote:
Agentstinky wrote:Anyone else reminded of Douglas Hofstadter? I'm working my way through "Godel, Escher, Bach" right now.


That was the first thing I thought once I realized where the comic was going. GEB is great, but do not skip the dialogues, even though he says they aren't mandatory reading, they really should be (in later chapters he will outright reference them). I Am a Strange Loop is a pretty good follow up as well, explains some of the stuff about cognition in a much clearer way with less math/logic (I mean this in that it is less confusing of a read) and virtually no music theory.


I'm a fan of Hofstadter's work, but for me he sorta jumped the shark with I Am a Strange Loop. All the mathy/sciency stuff is great, but he rather lost me with the metaphysical "my wife isn't dead" material in the second half of the book. I ended up returning it (library book) before I finished the last chapter.

His other work is fascinating, though!


That chapter drove me nuts too. Unfortunately for you, the last chapter tied a lot of things together (IIRC) without the aforementioned shark jumping.
Just because it is not physics doesn't mean it is not science.
http://www.iomalfunction.blogspot.com <---- A collection of humorous one liners and science jokes.
User avatar
RockoTDF
 
Posts: 582
Joined: Thu Oct 18, 2007 6:08 am UTC
Location: Tucson, AZ, US

Re: "Self-Description" Discussion

Postby davek » Thu Jan 14, 2010 6:06 am UTC

XKCD has officially gone recursive, a true sign of genius.
User avatar
davek
 
Posts: 1
Joined: Thu Jan 14, 2010 5:37 am UTC
Location: Schenectady, NY

Re: "Self-Description" Discussion

Postby warflango » Thu Jan 14, 2010 7:21 am UTC

This sentence contains sixty-six characters, including the period.

This sentence contains seventy-one characters, not including the period.
warflango
 
Posts: 6
Joined: Mon Nov 16, 2009 4:03 am UTC

Re: "Self-Description" Discussion

Postby Iridos » Thu Jan 14, 2010 7:38 am UTC

actually that's a nice exercise so let's have a look at this... if I was a math teacher, I'd be tempted to make that my next exam

b1,b2,b3 = black area in panel 1,2,3
c1,c2,c3 = constant amount of black in panel 1,2,3 (fonts, frame,scale/lines)
w = width of bars in bargraph (20 pixel)
h_max = height of bar graph that would represent 100% ( = 200 pixel)
scalefactor = factor by which graph in panel 3 is scaled (=0.254)
totalblack = total black area
totalarea = area of whole comic (= 740 pixel *180 pixel = 133200 square pixel )
r = radius of pie graph (= 73 pixel)


(1) totalblack = b1 + b2 + b3

these are the 4 variables... (everything else is known)

(2) b1 = c1 + \pi r^2 totalblack/totalarea

(3) b2 = c2 + w h1 + w h2 + w h3 = c2 + w (h1+h2+h3)

we'll have to assume that the bargraph shows a percentage - h_max would then be 100% and h1,h2,h3 accordingly:
h1 = h_{max} b1/totalblack;
h2 = h_{max} b2/totalblack ;
h3 = h_{max} b3/totalblack

hence (and, because of eq. 1 ),
(3a) b2 = c2 + w h_{max} /totalblack (b1+b2+b3) = c2 + w h_{max} /totalblack (totalblack) =c2 + w h_{max}

(the amount of ink used in graph 2 does not depend on the other graphs, because we show a bar for each panel and those bars always add up to 100% or h_max - that is of course not true, if we adjust h_max so that our bars don't become too small/big)

Panel 3 shows the whole thing scaled by scalefactor, which of course contains an even smaller version scaled by scalefactor^2 compared to the original which contains... etc. etc. (of course with pixels, you're not able to show that, but you'd approximate that by the correct grey values)

(4) b3= c3 + \Sigma_{n=1}^{\infty}(scalefactor^n totalblack) = c3+ totalblack \Sigma_{n=1}^{\infty}(scalefactor^n) = c3 + totalblack \frac{scalefactor}{1-scalefactor}

we have 4 variables and we have 4 equations - seems we got exactly one solution.

in the last step, the geometric progression was replaced by a simple fraction (showing how you get that with a bit of hand-waving):
x=\Sigma_{n=1}^{\infty}(scalefactor^n)
multiply both sides with scalefactor
scalefactor x=\Sigma_{n=2}^{\infty}(scalefactor^n)
substract both equations from each other
(1 - scalefactor) x =\Sigma_{n=1}^{\infty}(scalefactor^n)-\Sigma_{n=2}^{\infty}(scalefactor^n)= scalefactor
solve for x
x = \frac{scalefactor}{1 - scalefactor) }

so, putting all that back in eq. (1), we end up with:

totalblack - totalblack \frac{\pi r^2}{ totalarea} - totalblack \frac{scalefactor}{1-scalefactor} = totalblack ( 1 - \frac{\pi r^2}{ totalarea} - \frac{scalefactor}{1-scalefactor}) = c1+c2+c3+wh_{max}

i.e.
totalblack = \frac {c1 + c 2 + c3 + w h_{max}}{\frac{1-2 scalefactor}{1- scalefactor}-\frac{\pi r^2}{totalarea}}


from which we trivially get the fraction totalblack/totalarea for graph 1, b1 and b3 and hence h1,h2,h3 for graph 2 (b2 is already fixed with c2+w h_max) .

Measured from the comic (c1,c2,c3 are just the frames, graph-scales, text, etc, not the sector in the pie graph, the bars or the scaled graph):
c1=4705; c2=4997; c3=3259; w=20; hmax=200; scalefactor=0.254 ; totalarea=133200;r=73

(the corrections for possibly non-square pixels is left as an exercise to the reader...)



I.

Edit: correction: the scalefactor in a single dimension is 0.254 - for the used area that means A=xy ---> (x*0.254)*(y*0.254) = A*(0.254^2), right? So scalefactor=0.254^2=0.064516 (for the area // amount of ink used)
Last edited by Iridos on Thu Jan 14, 2010 6:20 pm UTC, edited 1 time in total.
User avatar
Iridos
 
Posts: 80
Joined: Wed Jan 28, 2009 6:58 am UTC

Re: "Self-Description" Discussion

Postby yet another steven » Thu Jan 14, 2010 10:39 am UTC

xfhsngki wrote:
SunDawg wrote:Only the fool would take trouble to verify that this sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens, and, last but not least, a single !
This fool sadly notes that the above sentence is incorrect on two counts :(


Indeed, there are 38 rather than 37 t's and 28 rather than 27 comma's. The original, correct version reads "Only the fool would take trouble to verify that HIS sentence...", and drops the comma before "and, last but not least". I like the shorter pangram I quoted on page 2 better, since it is harder to play around with to fix mismatches. As I mentioned before, you can find more on this stuff at http://www.fatrazie.com/EWpangram.html.
yet another steven
 
Posts: 47
Joined: Wed Jan 13, 2010 10:22 am UTC

Re: "Self-Description" Discussion

Postby JustDoug » Thu Jan 14, 2010 11:05 am UTC

Raptor Jesus wrote:Edit: I was ninja'd, feel free to skip this post

Wait, isn't the middle one impossible? Because to show the amount of ink that were in the first two, you would have to add more ink. Adding more ink would cause you to have to add even more ink to the #2 comic, therefore increasing the size of the bar, adding more ink, and repeating the loop....

Or am I just over thinking this? :mrgreen:


The amount of error can be best expressed as a function of accuracy necessary to achieve the punchline of the joke with a limit of time approching deadline.

Of course, it's pretty easy when your error bars are discrete, interger pixels, though their addition would likely throw off the results.
JustDoug
 
Posts: 82
Joined: Sun Oct 04, 2009 3:35 pm UTC

Re: "Self-Description" Discussion

Postby Fume Troll » Thu Jan 14, 2010 12:42 pm UTC

clanders wrote:I registered on this forum, a somewhat laborious process, simply so I could say that this comic might be the worst xkcd comic ever. And it has some competition.


How odd! It prompted me to register too, but because I thought it was one of the best xkcd comics ever. And it has some competition.

But then, I didn't find registering too tricky...
Fume Troll
 
Posts: 249
Joined: Wed Jan 13, 2010 8:06 am UTC
Location: Scotland / Norway mainly

Re: "Self-Description" Discussion

Postby sideshow » Thu Jan 14, 2010 1:22 pm UTC

Python + PIL (the Python Imaging Library)

Code: Select all
import Image, ImageDraw, ImageFont

STARTING_BLACKNESS = 0.1
STARTING_BLACKNESSES = (0.1, 0.1, 0.1)

canvas = Image.new("L", (740, 180), 255)

panel = Image.new("L", (240, 180), 255)
draw = ImageDraw.Draw(panel)
draw.rectangle([(0,0), (239,179)], outline=0)

font = ImageFont.truetype("tahoma.ttf", 10)

def make_panel1(blackness):
   im = panel.copy()
   draw = ImageDraw.Draw(im)
   pie_coords = (75,15,225,165)
   degrees = blackness * 180
   draw.ellipse(pie_coords)
   draw.pieslice(pie_coords, int(140-degrees), int(140+degrees), fill=0)
   draw.text((10,10), "FRACTION OF", font=font)
   draw.text((10,20), "THIS IMAGE", font=font)
   draw.text((10,30), "WHICH IS WHITE", font=font)
   draw.line([(70,25), (85,25), (105,45)])
   draw.text((10,130), "FRACTION OF", font=font)
   draw.text((10,140), "THIS IMAGE", font=font)
   draw.text((10,150), "WHICH IS BLACK", font=font)
   draw.line([(70,145), (85,145), (93,137)])
   draw.line([(93,137), (100,130)], fill=255)
   return im

def make_panel2(blacknesses):
   im = panel.copy()
   draw = ImageDraw.Draw(im)
   ratio = 85.0/max(blacknesses)
   heights = [int(x*ratio) for x in blacknesses]
   draw.line([(30,55), (30, 150), (210,150)])
   for i, bar in enumerate(heights):
      draw.rectangle([(55+i*55,150), (75+i*55,150-bar)], fill=0)
      draw.text((63+i*55,155), str(i+1), font=font)
   draw.text((10,10), "AMOUNT OF", font=font)
   draw.text((10,20), "BLACK INK", font=font)
   draw.text((10,30), "BY PANEL:", font=font)
   return im

def make_panel3(image):
   im = panel.copy()
   draw = ImageDraw.Draw(im)
   draw.line([(20,70), (20, 130), (225,130)])
   draw.line([(18,75), (20,70), (22,75)])
   draw.line([(220,128), (225,130), (220,132)])
   draw.line([(18,125), (22,125)])
   draw.ellipse([10,123, 14,127])
   draw.line([(25,128), (25,133)])
   draw.ellipse([23,135, 27,139])
   draw.text((10,10), "LOCATION OF", font=font)
   draw.text((10,20), "BLACK INK IN", font=font)
   draw.text((10,30), "THIS IMAGE:", font=font)
   mini = image.resize((190,46), Image.ANTIALIAS)
   im.paste(mini, (25, 80))
   return im
   
def get_blackness(image):
   black = white = 0
   for density, color in image.getcolors():
      black += density * (255-color)
      white += density * color
   return float(black)/white

class Comic(object):
   def __init__(self, blackness, blacknesses):
      self.image = canvas.copy()
      self.blackness = blackness
      self.blacknesses = list(blacknesses)
      self.panels = self.make_panels()
      
   def make_panels(self, blackness=None, blacknesses=None):
      if blackness == None:
         blackness = self.blackness
      if blacknesses == None:
         blacknesses = self.blacknesses
      self.panels = [
         make_panel1(blackness),
         make_panel2(blacknesses),
         make_panel3(self.image)
      ]
      self.render()
      self.panels[2] = make_panel3(self.image)
      self.render(just3=True)
      self.old_blackness = self.blackness
      self.old_blacknesses = self.blacknesses
      self.blackness = get_blackness(self.image)
      self.blacknesses = [get_blackness(x) for x in self.panels]
      
   def render(self, just3=False):
      if not just3:
         self.image = canvas.copy()
         self.image.paste(self.panels[0], (0,0))
         self.image.paste(self.panels[1], (250,0))
      self.image.paste(self.panels[2], (500,0))
   
   def stable(self):
      if self.blackness != self.old_blackness:
         return False
      for i in xrange(3):
         if self.blacknesses[i] != self.old_blacknesses[i]:
            return False
      return True

comic = Comic(STARTING_BLACKNESS, STARTING_BLACKNESSES)   

c = 0
while not comic.stable():
   c += 1
   comic.make_panels()
   
print "Stable after %d iterations." % c
print "Overall blackness:", round(comic.blackness, 4)
for i, b in enumerate(comic.blacknesses):
   print "Panel %d:" % (i+1), round(b, 4)

comic.image.show()


PIl's resize operation isn't great, even on antialias. I originally used 1bpp, but the resize for panel 3 just wouldn't make anything useful, so I upped it to 8bpp. Still doesn't look great, but works well enough to be recognisable. I get the following results:

Code: Select all
Stable after 9 iterations.
Overall blackness: 0.0983
Panel 1: 0.1044
Panel 2: 0.1422
Panel 3: 0.0605


selfreference.png
Resulting image
selfreference.png (9.53 KiB) Viewed 5128 times

compare.png
Comparison
sideshow
 
Posts: 3
Joined: Thu Jan 14, 2010 1:08 pm UTC

Re: "Self-Description" Discussion

Postby Fume Troll » Thu Jan 14, 2010 2:01 pm UTC

Bravo! What a first post!
Fume Troll
 
Posts: 249
Joined: Wed Jan 13, 2010 8:06 am UTC
Location: Scotland / Norway mainly

Re: "Self-Description" Discussion

Postby notgm » Thu Jan 14, 2010 2:03 pm UTC

JustDoug wrote:
Raptor Jesus wrote:Edit: I was ninja'd, feel free to skip this post

Wait, isn't the middle one impossible? Because to show the amount of ink that were in the first two, you would have to add more ink. Adding more ink would cause you to have to add even more ink to the #2 comic, therefore increasing the size of the bar, adding more ink, and repeating the loop....

Or am I just over thinking this? :mrgreen:


The amount of error can be best expressed as a function of accuracy necessary to achieve the punchline of the joke with a limit of time approching deadline.

Of course, it's pretty easy when your error bars are discrete, interger pixels, though their addition would likely throw off the results.



no, the second panel, second bar is impossible as presented. bar value = bar value + other items in panel. bar value keeps increasing as long as it isn't the only thing in the panel. including the border.
User avatar
notgm
 
Posts: 25
Joined: Mon Oct 20, 2008 7:19 pm UTC

Re: "Self-Description" Discussion

Postby dataxpress » Thu Jan 14, 2010 2:06 pm UTC

Now that you guys have solved this problem to death, I pose this challenge to you:

Create a string in this format:

"The MD5 of this string is c738b1ee48bf98a972810f15f78274e5"

Obviously, replacing the md5 above with the actual md5 of the whole string, including its md5...

This is like the nerd sniping comic, but instead of stopping a physicist in the road, I stopped posters in their replies :D

Spoiler:
and of course the example md5 I used is the md5 of "this string", dorks
I recommend filling soccer balls with napalm. Napalm is nature's toothpaste.
User avatar
dataxpress
 
Posts: 32
Joined: Mon Dec 03, 2007 5:04 am UTC

Re: "Self-Description" Discussion

Postby sticksmite » Thu Jan 14, 2010 3:50 pm UTC

Fume Troll wrote:
clanders wrote:I registered on this forum, a somewhat laborious process, simply so I could say that this comic might be the worst xkcd comic ever. And it has some competition.


How odd! It prompted me to register too, but because I thought it was one of the best xkcd comics ever. And it has some competition.

But then, I didn't find registering too tricky...


Same here. Awesome comic.

Perhaps there is a much more laborious registration process triggered when an applicant has derisive tendencies...wonder if he clicked the register button too forcefully. Mine was certainly easy enough. If it was in fact the same process, I'd like to know what type of job clanders has to make the registration seem 'laborious'.
sticksmite
 
Posts: 2
Joined: Wed Jan 13, 2010 11:28 pm UTC

Re: "Self-Description" Discussion

Postby zmonge » Thu Jan 14, 2010 3:53 pm UTC

shouldn't the bar for "amount of black in each panel," for panel number 3 increase infinitely? The comic repeats itself indefinitely, so the bar would continue to rise...at least until the amount of black became negligible.

I like the comic though! XKCD=the god of all webcomics.
zmonge
 
Posts: 6
Joined: Sat Apr 12, 2008 4:13 am UTC
Location: Memphis

Re: "Self-Description" Discussion

Postby Moonfish » Thu Jan 14, 2010 5:06 pm UTC

It reminds me of this comic:
Image
When I first saw Boing-Boing's Pac-man comic I was thinking about the pie chart of pie charts which resemble Pac-man.
Any opinions? Would that chart contain it'self?
User avatar
Moonfish
 
Posts: 15
Joined: Sat May 24, 2008 10:40 am UTC

Re: "Self-Description" Discussion

Postby jc » Thu Jan 14, 2010 6:42 pm UTC

rpresser wrote:http://esl.about.com/library/beginnercourse/bl_beginner_course_numberbasic.htm
In British English use "and" when saying numbers in the hundreds.
Example: seven hundred AND twenty seven.

In American English do NOT use "and" when saying numbers in the hundreds.
Example: seven hundred twenty seven.

Just recently, the folks at Language Log have dealt with this topic, and there was a pretty good summary article a few days ago. The general summary is that, as often happens, there is all sorts of prescriptivist nonsense about how to "correctly" read numbers in English, and linguists just sorta snicker at it all. The sensible conclusion is that to be fluent in English, you should be familiar with all of them, regardless of which you personally prefer.

There have been some pretty funny comments reminiscing about grade-school teachers who firmly taught that using "and" in numbers was either right or wrong. Nobody seems to know where they got their ideas, as is typical with such bogus grammatical pseudo-rules, since there don't seem to be any (major) style manuals that recommend or discourage "and" in numbers.
User avatar
jc
 
Posts: 199
Joined: Fri May 04, 2007 5:48 pm UTC
Location: Waltham, Massachusetts, USA, Earth, Solar System, Milky Way Galaxy

Re: "Self-Description" Discussion

Postby DonSasquatcho » Thu Jan 14, 2010 6:57 pm UTC

Xkcd falls into the logical fallacy of false dilemma when tries to describe itself in terms of black-or-white.
DonSasquatcho
 
Posts: 3
Joined: Mon Nov 16, 2009 5:49 pm UTC

Re: "Self-Description" Discussion

Postby XbHW_TestEngr » Thu Jan 14, 2010 7:30 pm UTC

... and there will be cake.

I have traveled from 1960 to be a member of the unofficial Council of Elders. Phear M3

benbald72 wrote:I feel connected to the author and therefore appreciate the comic, regardless of whether or not I understand the joke ....
User avatar
XbHW_TestEngr
 
Posts: 89
Joined: Sat Jan 17, 2009 9:29 pm UTC
Location: Tacoma, WA

Re: "Self-Description" Discussion

Postby Iridos » Thu Jan 14, 2010 7:42 pm UTC

sideshow wrote:Python + PIL (the Python Imaging Library)


Well done, you win the (broken) washing machine!

I have to say, though, that on my machine it doesn't fully converge ever - instead e.g. blackness jumps between 2 values (which are close enough so that relaxing the condition is sufficient to get to the result).

My feeling says that in this case, this mainly is a rounding // limited precision issue


Code: Select all
Values for blackness:
0.111216964147
0.0940381267423
0.0983651188005
0.0942792129154
0.0957376142309
0.0952751707155
0.0964824850917
0.0958822432812
0.0962834519199
0.0958814300559
0.0962834519199
0.0958814300559
0.0962834519199
0.0958814300559
0.0962834519199
0.0958814300559
0.0962834519199


Guess that just shows why iterating should be avoided when possible

I.
User avatar
Iridos
 
Posts: 80
Joined: Wed Jan 28, 2009 6:58 am UTC

Re: "Self-Description" Discussion

Postby deyat » Thu Jan 14, 2010 8:06 pm UTC

I find it odd that science-minded people all seem to be unaware of the that/which distinction - even those with otherwise excellent grammar.
deyat
 
Posts: 1
Joined: Thu Jan 14, 2010 7:02 pm UTC

Re: "Self-Description" Discussion

Postby dataxpress » Thu Jan 14, 2010 8:27 pm UTC

deyat wrote:I find it odd that science-minded people all seem to be unaware of the that/which distinction - even those with otherwise excellent grammar.


You know the rule.
I recommend filling soccer balls with napalm. Napalm is nature's toothpaste.
User avatar
dataxpress
 
Posts: 32
Joined: Mon Dec 03, 2007 5:04 am UTC

Re: "Self-Description" Discussion

Postby jc » Thu Jan 14, 2010 9:27 pm UTC

DonSasquatcho wrote:Xkcd falls into the logical fallacy of false dilemma when tries to describe itself in terms of black-or-white.

Indeed. And I noticed right off that the 3rd panel contains some gr[ae]y. I've been disappointed that this hasn't been thoroughly discussed.
User avatar
jc
 
Posts: 199
Joined: Fri May 04, 2007 5:48 pm UTC
Location: Waltham, Massachusetts, USA, Earth, Solar System, Milky Way Galaxy

Re: "Self-Description" Discussion

Postby sideshow » Thu Jan 14, 2010 9:40 pm UTC

Iridos wrote:
sideshow wrote:Python + PIL (the Python Imaging Library)


Well done, you win the (broken) washing machine!

I have to say, though, that on my machine it doesn't fully converge ever - instead e.g. blackness jumps between 2 values (which are close enough so that relaxing the condition is sufficient to get to the result).

My feeling says that in this case, this mainly is a rounding // limited precision issue


Code: Select all
Values for blackness:
0.111216964147
0.0940381267423
0.0983651188005
0.0942792129154
0.0957376142309
0.0952751707155
0.0964824850917
0.0958822432812
0.0962834519199
0.0958814300559
0.0962834519199
0.0958814300559
0.0962834519199
0.0958814300559
0.0962834519199
0.0958814300559
0.0962834519199


Guess that just shows why iterating should be avoided when possible

I.


Not so much a problem with iteration (which is always approximation), but with me being a little myopic. Originally I intended to check if the values were 'close enough' to the previous iteration's to be considered stable, but before I decided on how far apart that was I got it to print them out, and saw that they converged exactly. I took that at face value and just used equality; not a good idea with floats. I was quite surprised when it did it, but it was only after posting I thought about other setups not matching mine (and that my "0"s could be less circular, and that the text at the bottom of panel 1 should be lower...).

You can change the stable method to:
Code: Select all
   def stable(self):
      epsilon = 0.0000001
      if abs(self.blackness-self.old_blackness) > epsilon:
         return False
      for i in xrange(3):
         if abs(self.blacknesses[i]-self.old_blacknesses[i]) > epsilon:
            return False
      return True


and vary the size of epsilon for more or less precision: too large and it will converge with a high degree of error, too small and it won't converge at all...
Last edited by sideshow on Thu Jan 14, 2010 9:42 pm UTC, edited 1 time in total.
sideshow
 
Posts: 3
Joined: Thu Jan 14, 2010 1:08 pm UTC

Re: "Self-Description" Discussion

Postby jc » Thu Jan 14, 2010 9:41 pm UTC

deyat wrote:I find it odd that science-minded people all seem to be unaware of the that/which distinction - even those with otherwise excellent grammar.

This is because, for as long as the English language has existed, those words have been used inconsistently and interchangeably (when used as relative pronouns). True, a lot of grammatical rules about them have been written by various would-be grammarians, but they tend to contradict each other. Whatever rule you follow, half the prescriptivists will call you an idiot for getting it wrong. The only sensible thing to do is treat them as synonyms, and don't worry about it. Anyone learning English "as a foreign language' learns this by induction fairly quickly.

(In uses other than as relative pronouns, they are distinct. Thus, "Which one do you want?" is normal English; "That one do you want?" flags you as not a native speaker. ;-)
User avatar
jc
 
Posts: 199
Joined: Fri May 04, 2007 5:48 pm UTC
Location: Waltham, Massachusetts, USA, Earth, Solar System, Milky Way Galaxy

Re: "Self-Description" Discussion

Postby phlip » Thu Jan 14, 2010 10:24 pm UTC

jc wrote:Indeed. And I noticed right off that the 3rd panel contains some gr[ae]y. I've been disappointed that this hasn't been thoroughly discussed.

It's been discussed reasonably thoroughly... people tend to either use a threshold of some kind (because it's quick and easy) or count a n%-grey pixel as n% of a black pixel (because that's really what it is, for antialiasing).
While no one overhear you quickly tell me not cow cow.
but how about watch phone?
User avatar
phlip
Restorer of Worlds
 
Posts: 7087
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia

Re: "Self-Description" Discussion

Postby Splarka » Fri Jan 15, 2010 1:24 am UTC

synthesis77 wrote:
Splarka wrote:When is "This sentence is spoken with [0-9]* syllables" true?


Registered just to answer this!

"This sentence is spoken with syllables"


Yah, you got it first. That was the original (intended, though by no means the ONLY) answer of my pathetic quiz.
HTTP/1.1 - 203
User avatar
Splarka
 
Posts: 48
Joined: Thu Apr 12, 2007 10:24 am UTC

Re: "Self-Description" Discussion

Postby dennisw » Fri Jan 15, 2010 1:31 am UTC

deyat wrote:I find it odd that science-minded people all seem to be unaware of the that/which distinction - even those with otherwise excellent grammar.

I don't think it's such a big deal that you should lose any sleep over it, which is why I offer you this link.
Try the Printifier for xkcd. You can now scale the comic between 50 and 150%.

I find these very useful: Common Errors in English Usage (web site) and Eats, Shoots & Leaves (book). You may, too.

e pluribus unum
Unleash unlicensed ungulates!
User avatar
dennisw
 
Posts: 438
Joined: Wed Nov 05, 2008 9:09 am UTC
Location: Appearing pro se AND pro bono!

Re: "Self-Description" Discussion

Postby yet another steven » Fri Jan 15, 2010 10:51 am UTC

deyat wrote:I find it odd that science-minded people all seem to be unaware of the that/which distinction - even those with otherwise excellent grammar.


The supposedly correct usage does not match what I find out there in the wild, even in otherwise well written English. So the choice is between using what other people use, and using what some purists say you should use. I think it's a matter of personal preference rather than of language ability. Not all of us like to embark on Strunk and White's which-hunts. I mean, would you also argue that people should write "You are smaller than I"? Makes more grammatical sense than "You are smaller than me", but it would make for very distracting prose.
yet another steven
 
Posts: 47
Joined: Wed Jan 13, 2010 10:22 am UTC

Re: "Self-Description" Discussion

Postby dennisw » Fri Jan 15, 2010 1:24 pm UTC

yet another steven wrote:
deyat wrote:I find it odd that science-minded people all seem to be unaware of the that/which distinction - even those with otherwise excellent grammar.


The supposedly correct usage does not match what I find out there in the wild, even in otherwise well written English. So the choice is between using what other people use, and using what some purists say you should use. I think it's a matter of personal preference rather than of language ability. Not all of us like to embark on Strunk and White's which-hunts. I mean, would you also argue that people should write "You are smaller than I"? Makes more grammatical sense than "You are smaller than me", but it would make for very distracting prose.

I see what you did there.
Try the Printifier for xkcd. You can now scale the comic between 50 and 150%.

I find these very useful: Common Errors in English Usage (web site) and Eats, Shoots & Leaves (book). You may, too.

e pluribus unum
Unleash unlicensed ungulates!
User avatar
dennisw
 
Posts: 438
Joined: Wed Nov 05, 2008 9:09 am UTC
Location: Appearing pro se AND pro bono!

Re: "Self-Description" Discussion

Postby blackenedbutterfly » Fri Jan 15, 2010 4:08 pm UTC

I think it would have been a smidge funnier and a bit of a tip of the hat, were Randall to have exactly 216 characters in the mouseover text :P
blackenedbutterfly
 
Posts: 2
Joined: Fri Jan 01, 2010 8:53 am UTC

Re: "Self-Description" Discussion

Postby peter f » Fri Jan 15, 2010 5:58 pm UTC

The python code looks nice.
I have writen basically the same with Mathematica for those who are interested (like me :-) )

for some reason, i cannot attach *.nb files, so you have to save the following mathematica-notebook-code as an *.nb file to open it.

Code: Select all
(* Content-type: application/mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 6.0' *)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[TextData[{
 "XKCD 688 \"Self-Description\" with (",
 StyleBox["Mathematica",
  FontSlant->"Italic"],
 " code by Peter Frentrup)"
}], "Section"],

Cell[TextData[{
 "Idea is from: ",
 ButtonBox["http://xkcd.com/688/",
  BaseStyle->"Hyperlink",
  ButtonData->{
    URL["http://xkcd.com/688/"], None}],
 "."
}], "Text"],

Cell[CellGroupData[{

Cell["The implementation", "Subsection"],

Cell[BoxData[{
 RowBox[{
  RowBox[{"d", "=", "0.1"}], ";"}], "\[IndentingNewLine]",
 RowBox[{
  RowBox[{"pw", "=",
   RowBox[{"GoldenRatio", "-",
    RowBox[{"d", "/", "2"}]}]}], ";"}], "\[IndentingNewLine]",
 RowBox[{
  RowBox[{
   RowBox[{"font", "=", "\"\<Comic Sans MS\>\""}], ";"}],
  "\[IndentingNewLine]"}], "\[IndentingNewLine]",
 RowBox[{
  RowBox[{
   RowBox[{"b2g", "[",
    RowBox[{"g_", ",", "b1_", ",", "b2_", ",", "b3_"}], "]"}], ":=",
   RowBox[{"Graphics", "[",
    RowBox[{"{",
     RowBox[{"Thick", ",", "\[IndentingNewLine]",
      RowBox[{"(*", " ",
       RowBox[{"panel", " ", "frames"}], " ", "*)"}], "\[IndentingNewLine]",
      RowBox[{"Table", "[",
       RowBox[{
        RowBox[{"With", "[",
         RowBox[{
          RowBox[{"{",
           RowBox[{"x", "=",
            RowBox[{"i", "*",
             RowBox[{"(",
              RowBox[{"pw", "+", "d"}], ")"}]}]}], "}"}], ",",
          RowBox[{"Line", "[",
           RowBox[{"{",
            RowBox[{
             RowBox[{"{",
              RowBox[{"x", ",", "0"}], "}"}], ",",
             RowBox[{"{",
              RowBox[{
               RowBox[{"x", "+", "pw"}], ",", "0"}], "}"}], ",",
             RowBox[{"{",
              RowBox[{
               RowBox[{"x", "+", "pw"}], ",", "1"}], "}"}], ",",
             RowBox[{"{",
              RowBox[{"x", ",", "1"}], "}"}], ",",
             RowBox[{"{",
              RowBox[{"x", ",", "0"}], "}"}]}], "}"}], "]"}]}], "]"}], ",",
        RowBox[{"{",
         RowBox[{"i", ",", "0", ",", "2"}], "}"}]}], "]"}], ",",
      "\[IndentingNewLine]",
      RowBox[{"{",
       RowBox[{"(*", " ",
        RowBox[{"left", " ", "panel"}], " ", "*)"}], "\[IndentingNewLine]",
       RowBox[{"With", "[",
        RowBox[{
         RowBox[{"{",
          RowBox[{
           RowBox[{"cx", "=",
            RowBox[{"pw", "-", "0.5"}]}], ",",
           RowBox[{"cy", "=", "0.5"}]}], "}"}], ",", "\[IndentingNewLine]",
         RowBox[{"{",
          RowBox[{
           RowBox[{"Circle", "[",
            RowBox[{
             RowBox[{"{",
              RowBox[{"cx", ",", "cy"}], "}"}], ",", "0.4"}], "]"}], ",",
           "\[IndentingNewLine]",
           RowBox[{"Disk", "[",
            RowBox[{
             RowBox[{"{",
              RowBox[{"cx", ",", "cy"}], "}"}], ",", "0.4", ",",
             RowBox[{
              RowBox[{
               FractionBox["7", "6"], "\[Pi]"}], "+",
              RowBox[{
               RowBox[{"{",
                RowBox[{
                 RowBox[{"-", "\[Pi]"}], ",", "\[Pi]"}], "}"}],
               RowBox[{"(",
                FractionBox[
                 RowBox[{"b1", "+", "b2", "+", "b3"}], "3"], ")"}]}]}]}],
            "]"}], ",", "\[IndentingNewLine]",
           RowBox[{"With", "[",
            RowBox[{
             RowBox[{"{",
              RowBox[{
               RowBox[{"c", "=",
                RowBox[{"Cos", "[",
                 RowBox[{
                  FractionBox["7", "6"], "\[Pi]"}], "]"}]}], ",",
               RowBox[{"s", "=",
                RowBox[{"Sin", "[",
                 RowBox[{
                  FractionBox["7", "6"], "\[Pi]"}], "]"}]}]}], "}"}], ",",
             "\[IndentingNewLine]",
             RowBox[{"{",
              RowBox[{
               RowBox[{"Line", "[",
                RowBox[{"{",
                 RowBox[{
                  RowBox[{"{",
                   RowBox[{"cx", ",", "cy"}], "}"}], ",",
                  RowBox[{"{",
                   RowBox[{
                    RowBox[{"cx", "+",
                    RowBox[{"0.55", "c"}]}], ",",
                    RowBox[{"cy", "+",
                    RowBox[{"0.55", "s"}]}]}], "}"}], ",",
                  RowBox[{"{",
                   RowBox[{"d", ",",
                    RowBox[{"cy", "+",
                    RowBox[{"0.55", "s"}]}]}], "}"}]}], "}"}], "]"}], ",",
               "\[IndentingNewLine]", "White", ",", "\[IndentingNewLine]",
               RowBox[{"Line", "[",
                RowBox[{"{",
                 RowBox[{
                  RowBox[{"{",
                   RowBox[{
                    RowBox[{"cx", "+",
                    RowBox[{"0.4", "c"}]}], ",",
                    RowBox[{"cy", "+",
                    RowBox[{"0.4", "s"}]}]}], "}"}], ",",
                  RowBox[{"{",
                   RowBox[{
                    RowBox[{"cx", "+",
                    RowBox[{"0.3", "c"}]}], ",",
                    RowBox[{"cy", "+",
                    RowBox[{"0.3", "s"}]}]}], "}"}]}], "}"}], "]"}]}],
              "}"}]}], "]"}], ",", "\[IndentingNewLine]",
           RowBox[{"With", "[",
            RowBox[{
             RowBox[{"{",
              RowBox[{
               RowBox[{"c", "=",
                RowBox[{"Cos", "[",
                 RowBox[{
                  FractionBox["3", "4"], "\[Pi]"}], "]"}]}], ",",
               RowBox[{"s", "=",
                RowBox[{"Sin", "[",
                 RowBox[{
                  FractionBox["3", "4"], "\[Pi]"}], "]"}]}]}], "}"}], ",",
             "\[IndentingNewLine]",
             RowBox[{"Line", "[",
              RowBox[{"{",
               RowBox[{
                RowBox[{"{",
                 RowBox[{
                  RowBox[{"cx", "+",
                   RowBox[{"0.3", "c"}]}], ",",
                  RowBox[{"cy", "+",
                   RowBox[{"0.3", "s"}]}]}], "}"}], ",",
                RowBox[{"{",
                 RowBox[{
                  RowBox[{"cx", "+",
                   RowBox[{"0.5", "c"}]}], ",",
                  RowBox[{"cy", "+",
                   RowBox[{"0.5", "s"}]}]}], "}"}], ",",
                RowBox[{"{",
                 RowBox[{"d", ",",
                  RowBox[{"cy", "+",
                   RowBox[{"0.5", "s"}]}]}], "}"}]}], "}"}], "]"}]}], "]"}],
           ",", "\[IndentingNewLine]",
           RowBox[{"Text", "[",
            RowBox[{
             RowBox[{"Style", "[",
              RowBox[{
              "\"\<FRACTION OF\\nTHIS IMAGE  \\nWHICH IS BLACK\>\"", ",",
               "\[IndentingNewLine]",
               RowBox[{"Background", "\[Rule]", "White"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"FontWeight", "\[Rule]", "Bold"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"FontFamily", "\[Rule]", "font"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"TextAlignment", "\[Rule]", "Left"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"FontSize", "\[Rule]",
                RowBox[{"Scaled", "[",
                 FractionBox["0.05",
                  RowBox[{
                   RowBox[{"3", "*", "pw"}], "+",
                   RowBox[{"2", "*", "d"}]}]], "]"}]}]}], "]"}], ",",
             RowBox[{"{",
              RowBox[{
               RowBox[{"d", "/", "2"}], ",",
               RowBox[{"d", "/", "2"}]}], "}"}], ",",
             RowBox[{"{",
              RowBox[{
               RowBox[{"-", "1"}], ",",
               RowBox[{"-", "1"}]}], "}"}]}], "]"}], ",",
           "\[IndentingNewLine]",
           RowBox[{"Text", "[",
            RowBox[{
             RowBox[{"Style", "[",
              RowBox[{
              "\"\<FRACTION OF\\nTHIS IMAGE  \\nWHICH IS WHITE\>\"", ",",
               "\[IndentingNewLine]",
               RowBox[{"Background", "\[Rule]", "White"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"FontWeight", "\[Rule]", "Bold"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"FontFamily", "\[Rule]", "font"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"TextAlignment", "\[Rule]", "Left"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"FontSize", "\[Rule]",
                RowBox[{"Scaled", "[",
                 FractionBox["0.05",
                  RowBox[{
                   RowBox[{"3", "*", "pw"}], "+",
                   RowBox[{"2", "*", "d"}]}]], "]"}]}]}], "]"}], ",",
             "\[IndentingNewLine]",
             RowBox[{"{",
              RowBox[{
               RowBox[{"d", "/", "2"}], ",",
               RowBox[{"1", "-",
                RowBox[{"d", "/", "2"}]}]}], "}"}], ",",
             RowBox[{"{",
              RowBox[{
               RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "]"}]}], "}"}]}],
        "]"}], "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]",
      RowBox[{"{",
       RowBox[{"(*", " ",
        RowBox[{"middle", " ", "panel"}], "*)"}], "\[IndentingNewLine]",
       RowBox[{"With", "[",
        RowBox[{
         RowBox[{"{",
          RowBox[{
           RowBox[{"lef", "=",
            RowBox[{"pw", "+",
             RowBox[{"3", "d"}]}]}], ",",
           RowBox[{"rig", "=",
            RowBox[{"2", "pw"}]}], ",",
           RowBox[{"bot", "=",
            RowBox[{"1.5", "d"}]}], ",",
           RowBox[{"top", "=",
            RowBox[{"1", "-",
             RowBox[{"3", "d"}]}]}]}], "}"}], ",", "\[IndentingNewLine]",
         RowBox[{"{",
          RowBox[{
           RowBox[{"Line", "[",
            RowBox[{"{",
             RowBox[{
              RowBox[{"{",
               RowBox[{"lef", ",", "top"}], "}"}], ",",
              RowBox[{"{",
               RowBox[{"lef", ",", "bot"}], "}"}], ",",
              RowBox[{"{",
               RowBox[{"rig", ",", "bot"}], "}"}]}], "}"}], "]"}], ",",
           "\[IndentingNewLine]",
           RowBox[{"Table", "[",
            RowBox[{
             RowBox[{"With", "[",
              RowBox[{
               RowBox[{"{",
                RowBox[{"w", "=",
                 RowBox[{"0.3",
                  RowBox[{"(",
                   RowBox[{"rig", "-", "lef"}], ")"}]}]}], "}"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"With", "[",
                RowBox[{
                 RowBox[{"{",
                  RowBox[{"x", "=",
                   RowBox[{"lef", " ", "+", " ",
                    RowBox[{"i", " ", "*", " ", "w"}], "-",
                    RowBox[{"w", "/", "3"}]}]}], "}"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"{",
                  RowBox[{
                   RowBox[{"Rectangle", "[",
                    RowBox[{
                    RowBox[{"{",
                    RowBox[{"x", ",", "bot"}], "}"}], ",",
                    RowBox[{"{",
                    RowBox[{
                    RowBox[{"x", "+",
                    RowBox[{"w", "/", "3"}]}], ",",
                    RowBox[{"bot", "+",
                    RowBox[{
                    RowBox[{"(",
                    RowBox[{"top", "-", "bot"}], ")"}], "*",
                    FractionBox[
                    RowBox[{
                    RowBox[{"{",
                    RowBox[{"b1", ",", "b2", ",", "b3"}], "}"}],
                    "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}],
                    RowBox[{
                    RowBox[{"Max", "[",
                    RowBox[{"b1", ",", "b2", ",", "b3"}], "]"}], "*",
                    "1.2"}]]}]}]}], "}"}]}], "]"}], ",",
                   "\[IndentingNewLine]",
                   RowBox[{"Text", "[",
                    RowBox[{
                    RowBox[{"Style", "[",
                    RowBox[{"i", ",", "\[IndentingNewLine]",
                    RowBox[{"FontWeight", "\[Rule]", "Bold"}], ",",
                    "\[IndentingNewLine]",
                    RowBox[{"FontFamily", "\[Rule]", "font"}], ",",
                    "\[IndentingNewLine]",
                    RowBox[{"TextAlignment", "\[Rule]", "Left"}], ",",
                    "\[IndentingNewLine]",
                    RowBox[{"FontSize", "\[Rule]",
                    RowBox[{"Scaled", "[",
                    FractionBox["0.06",
                    RowBox[{
                    RowBox[{"3", "*", "pw"}], "+",
                    RowBox[{"2", "*", "d"}]}]], "]"}]}]}], "]"}], ",",
                    "\[IndentingNewLine]",
                    RowBox[{"{",
                    RowBox[{
                    RowBox[{"x", "+",
                    RowBox[{"w", "/", "6"}]}], ",",
                    RowBox[{"bot", "-",
                    RowBox[{"d", "/", "4"}]}]}], "}"}], ",",
                    RowBox[{"{",
                    RowBox[{"0", ",", "1"}], "}"}]}], "]"}]}], "}"}]}],
                "]"}]}], "]"}], ",", "\[IndentingNewLine]",
             RowBox[{"{",
              RowBox[{"i", ",", "3"}], "}"}]}], "]"}], ",",
           "\[IndentingNewLine]",
           RowBox[{"Text", "[",
            RowBox[{
             RowBox[{"Style", "[",
              RowBox[{
              "\"\<AMOUNT OF\\nBLACK INK\\nBY PANEL:\>\"", ",",
               "\[IndentingNewLine]",
               RowBox[{"FontWeight", "\[Rule]", "Bold"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"FontFamily", "\[Rule]", "font"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"TextAlignment", "\[Rule]", "Left"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"FontSize", "\[Rule]",
                RowBox[{"Scaled", "[",
                 FractionBox["0.05",
                  RowBox[{
                   RowBox[{"3", "*", "pw"}], "+",
                   RowBox[{"2", "*", "d"}]}]], "]"}]}]}], "]"}], ",",
             "\[IndentingNewLine]",
             RowBox[{"{",
              RowBox[{
               RowBox[{"pw", "+",
                RowBox[{"1.5", "d"}]}], ",",
               RowBox[{"1", "-",
                RowBox[{"0.5", "d"}]}]}], "}"}], ",",
             RowBox[{"{",
              RowBox[{
               RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "]"}]}],
          "\[IndentingNewLine]", "}"}]}], "]"}], "\[IndentingNewLine]", "}"}],
       ",", "\[IndentingNewLine]",
      RowBox[{"{",
       RowBox[{"(*", " ",
        RowBox[{"right", " ", "panel"}], " ", "*)"}], "\[IndentingNewLine]",
       RowBox[{"With", "[",
        RowBox[{
         RowBox[{"{",
          RowBox[{
           RowBox[{"lef", "=",
            RowBox[{
             RowBox[{"2", "pw"}], "+",
             RowBox[{"4", "d"}]}]}], ",",
           RowBox[{"rig", "=",
            RowBox[{
             RowBox[{"3", "pw"}], "+", "d"}]}], ",",
           RowBox[{"w", "=",
            RowBox[{
             RowBox[{"3", "pw"}], "+",
             RowBox[{"2", "d"}]}]}]}], "}"}], ",", "\[IndentingNewLine]",
         RowBox[{"With", "[",
          RowBox[{
           RowBox[{"{",
            RowBox[{
             RowBox[{"y0", "=",
              RowBox[{"0.4", "-",
               FractionBox[
                RowBox[{"rig", "-", "lef"}],
                RowBox[{"2", "w"}]]}]}], ",",
             RowBox[{"h", "=",
              FractionBox[
               RowBox[{"rig", "-", "lef"}], "w"]}], ",",
             RowBox[{"dd", "=",
              RowBox[{"d", "/", "3"}]}]}], "}"}], ",", "\[IndentingNewLine]",
           
           RowBox[{"{",
            RowBox[{
             RowBox[{"Arrowheads", "[", "0.01", "]"}], ",",
             "\[IndentingNewLine]",
             RowBox[{"Arrow", "[",
              RowBox[{"{",
               RowBox[{
                RowBox[{"{",
                 RowBox[{
                  RowBox[{"lef", "-", "dd"}], ",",
                  RowBox[{"y0", "-", "dd"}]}], "}"}], ",",
                RowBox[{"{",
                 RowBox[{
                  RowBox[{"lef", "-", "dd"}], ",",
                  RowBox[{"y0", "+", "h", "+",
                   RowBox[{"2", "dd"}]}]}], "}"}]}], "}"}], "]"}], ",",
             "\[IndentingNewLine]",
             RowBox[{"Arrow", "[",
              RowBox[{"{",
               RowBox[{
                RowBox[{"{",
                 RowBox[{
                  RowBox[{"lef", "-", "dd"}], ",",
                  RowBox[{"y0", "-", "dd"}]}], "}"}], ",",
                RowBox[{"{",
                 RowBox[{
                  RowBox[{"rig", "+",
                   RowBox[{"2", "dd"}]}], ",",
                  RowBox[{"y0", "-", "dd"}]}], "}"}]}], "}"}], "]"}], ",",
             "\[IndentingNewLine]",
             RowBox[{"Line", "[",
              RowBox[{"{",
               RowBox[{
                RowBox[{"{",
                 RowBox[{
                  RowBox[{"lef", "-",
                   RowBox[{"1.3", "dd"}]}], ",", "y0"}], "}"}], ",",
                RowBox[{"{",
                 RowBox[{
                  RowBox[{"lef", "-",
                   RowBox[{"0.7", "dd"}]}], ",", "y0"}], "}"}]}], "}"}],
              "]"}], ",", "\[IndentingNewLine]",
             RowBox[{"Line", "[",
              RowBox[{"{",
               RowBox[{
                RowBox[{"{",
                 RowBox[{"lef", ",",
                  RowBox[{"y0", "-",
                   RowBox[{"1.3", "dd"}]}]}], "}"}], ",",
                RowBox[{"{",
                 RowBox[{"lef", ",",
                  RowBox[{"y0", "-",
                   RowBox[{"0.7", "dd"}]}]}], "}"}]}], "}"}], "]"}], ",",
             "\[IndentingNewLine]",
             RowBox[{"Text", "[",
              RowBox[{
               RowBox[{"Style", "[",
                RowBox[{"\"\<0\>\"", ",", "\[IndentingNewLine]",
                 RowBox[{"FontWeight", "\[Rule]", "Bold"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"FontFamily", "\[Rule]", "font"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"TextAlignment", "\[Rule]", "Left"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"FontSize", "\[Rule]",
                  RowBox[{"Scaled", "[",
                   FractionBox["0.05",
                    RowBox[{
                    RowBox[{"3", "*", "pw"}], "+",
                    RowBox[{"2", "*", "d"}]}]], "]"}]}]}], "]"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"{",
                RowBox[{
                 RowBox[{"lef", "-",
                  RowBox[{"2", "dd"}]}], ",", "y0"}], "}"}], ",",
               RowBox[{"{",
                RowBox[{"1", ",", "0"}], "}"}]}], "]"}], ",",
             "\[IndentingNewLine]",
             RowBox[{"Text", "[",
              RowBox[{
               RowBox[{"Style", "[",
                RowBox[{"\"\<0\>\"", ",", "\[IndentingNewLine]",
                 RowBox[{"FontWeight", "\[Rule]", "Bold"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"FontFamily", "\[Rule]", "font"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"TextAlignment", "\[Rule]", "Left"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"FontSize", "\[Rule]",
                  RowBox[{"Scaled", "[",
                   FractionBox["0.05",
                    RowBox[{
                    RowBox[{"3", "*", "pw"}], "+",
                    RowBox[{"2", "*", "d"}]}]], "]"}]}]}], "]"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"{",
                RowBox[{"lef", ",",
                 RowBox[{"y0", "-",
                  RowBox[{"2", "dd"}]}]}], "}"}], ",",
               RowBox[{"{",
                RowBox[{"0", ",", "1"}], "}"}]}], "]"}], ",",
             "\[IndentingNewLine]",
             RowBox[{"Inset", "[",
              RowBox[{"g", ",",
               RowBox[{"{",
                RowBox[{"lef", ",", "y0"}], "}"}], ",",
               RowBox[{"{",
                RowBox[{"0", ",", "0"}], "}"}], ",",
               RowBox[{"Scaled", "[",
                RowBox[{
                 RowBox[{"{",
                  RowBox[{"1", ",", "1"}], "}"}], "*", "h"}], "]"}]}], "]"}],
             ",", "\[IndentingNewLine]",
             RowBox[{"Text", "[",
              RowBox[{
               RowBox[{"Style", "[",
                RowBox[{
                "\"\<LOCATION OF\\nBLACK INK IN\\nTHIS IMAGE\>\"", ",",
                 "\[IndentingNewLine]",
                 RowBox[{"Background", "\[Rule]", "White"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"FontWeight", "\[Rule]", "Bold"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"FontFamily", "\[Rule]", "font"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"TextAlignment", "\[Rule]", "Left"}], ",",
                 "\[IndentingNewLine]",
                 RowBox[{"FontSize", "\[Rule]",
                  RowBox[{"Scaled", "[",
                   FractionBox["0.05",
                    RowBox[{
                    RowBox[{"3", "*", "pw"}], "+",
                    RowBox[{"2", "*", "d"}]}]], "]"}]}]}], "]"}], ",",
               "\[IndentingNewLine]",
               RowBox[{"{",
                RowBox[{
                 RowBox[{
                  RowBox[{"2", "pw"}], "+",
                  RowBox[{"3", "d"}]}], ",",
                 RowBox[{"1", "-",
                  RowBox[{"d", "/", "2"}]}]}], "}"}], ",",
               RowBox[{"{",
                RowBox[{
                 RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "]"}]}], "}"}]}],
          "]"}]}], "\[IndentingNewLine]", "]"}], "\[IndentingNewLine]",
       "}"}]}], "}"}], "]"}]}],
  "\[IndentingNewLine]"}], "\[IndentingNewLine]",
 RowBox[{
  RowBox[{"step", "[",
   RowBox[{"{",
    RowBox[{"g_", ",", "b1_", ",", "b2_", ",", "b3_"}], "}"}], "]"}], ":=",
  " ",
  RowBox[{"Module", "[",
   RowBox[{
    RowBox[{"{",
     RowBox[{"g2", ",", "pix"}], "}"}], ",", "\[IndentingNewLine]",
    RowBox[{
     RowBox[{"g2", "=",
      RowBox[{"Rasterize", "[",
       RowBox[{
        RowBox[{"b2g", "[",
         RowBox[{"g", ",", "b1", ",", "b2", ",", "b3"}], "]"}], ",",
        RowBox[{"ImageSize", "\[Rule]", "1000"}]}], "]"}]}], ";",
     "\[IndentingNewLine]",
     RowBox[{"pix", "=",
      RowBox[{
       RowBox[{"g2", "\[LeftDoubleBracket]",
        RowBox[{"1", ",", "1"}], "\[RightDoubleBracket]"}], "/", "255.0"}]}],
     ";", "\[IndentingNewLine]",
     RowBox[{"{",
      RowBox[{"g2", ",", "\[IndentingNewLine]",
       RowBox[{"1", "-",
        RowBox[{"Mean", "[",
         RowBox[{"Flatten", "[",
          RowBox[{"pix", "\[LeftDoubleBracket]",
           RowBox[{"All", ",",
            RowBox[{";;",
             RowBox[{"\[LeftCeiling]",
              FractionBox[
               RowBox[{"Length", "[",
                RowBox[{
                "pix", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
                 "]"}], "3"], "\[RightCeiling]"}]}]}],
           "\[RightDoubleBracket]"}], "]"}], "]"}]}], ",",
       "\[IndentingNewLine]",
       RowBox[{"1", "-",
        RowBox[{"Mean", "[",
         RowBox[{"Flatten", "[",
          RowBox[{"pix", "\[LeftDoubleBracket]",
           RowBox[{"All", ",",
            RowBox[{
             RowBox[{"\[LeftFloor]",
              FractionBox[
               RowBox[{"Length", "[",
                RowBox[{
                "pix", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
                 "]"}], "3"], "\[RightFloor]"}], ";;",
             RowBox[{"\[LeftCeiling]",
              FractionBox[
               RowBox[{"2",
                RowBox[{"Length", "[",
                 RowBox[{
                 "pix", "\[LeftDoubleBracket]", "1",
                  "\[RightDoubleBracket]"}], "]"}]}], "3"],
              "\[RightCeiling]"}]}]}], "\[RightDoubleBracket]"}], "]"}],
         "]"}]}], ",", "\[IndentingNewLine]",
       RowBox[{"1", "-",
        RowBox[{"Mean", "[",
         RowBox[{"Flatten", "[",
          RowBox[{"pix", "\[LeftDoubleBracket]",
           RowBox[{"All", ",",
            RowBox[{
             RowBox[{"\[LeftFloor]",
              FractionBox[
               RowBox[{"2",
                RowBox[{"Length", "[",
                 RowBox[{
                 "pix", "\[LeftDoubleBracket]", "1",
                  "\[RightDoubleBracket]"}], "]"}]}], "3"], "\[RightFloor]"}],
              ";;"}]}], "\[RightDoubleBracket]"}], "]"}], "]"}]}]}],
      "}"}]}]}], "\[IndentingNewLine]", "]"}]}]}], "Input",
 InitializationCell->True]
}, Closed]],

Cell[CellGroupData[{

Cell["\<\
Creating the image (1000 pixels wide \[Dash] might take some seconds \[Dash] \
17s on my PC)\
\>", "Subsection"],

Cell[BoxData[
 RowBox[{"FixedPoint", "[",
  RowBox[{"step", ",",
   RowBox[{"{",
    RowBox[{
     RowBox[{"Graphics", "[",
      RowBox[{"{", "}"}], "]"}], ",", "0.5", ",", "0.5", ",", "0.5"}],
    "}"}]}], "]"}]], "Input"]
}, Open  ]]
}, Open  ]]
},
AutoGeneratedPackage->None,
WindowSize->{1096, 549},
WindowMargins->{{22, Automatic}, {Automatic, 27}},
FrontEndVersion->"6.0 for Microsoft Windows (32-bit) (April 28, 2007)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)


here is the result image of calling FixedPoint[step, {Graphics[{}], 0.5, 0.5, 0.5}]:

xkcd-688.png
Mathematica's result


cheers!
peter
peter f
 
Posts: 1
Joined: Fri Jan 15, 2010 5:29 pm UTC

Re: "Self-Description" Discussion

Postby DonOregano » Fri Jan 15, 2010 11:55 pm UTC

This seems like an excellent thread to share my favorite palindrome:

Rettebs! I flahd, noces eh? Ttu, but the second half is better.
DonOregano
 
Posts: 2
Joined: Fri Jan 15, 2010 11:48 pm UTC

Re: "Self-Description" Discussion

Postby dennisw » Sat Jan 16, 2010 1:43 am UTC

peter f wrote:The python code looks nice.
I have writen basically the same with Mathematica for those who are interested (like me :-) )

for some reason, i cannot attach *.nb files, so you have to save the following mathematica-notebook-code as an *.nb file to open it.


cheers!
peter

Wow! The code has way more pixels than the chart! Are you sure there's not some better way to do that?
Try the Printifier for xkcd. You can now scale the comic between 50 and 150%.

I find these very useful: Common Errors in English Usage (web site) and Eats, Shoots & Leaves (book). You may, too.

e pluribus unum
Unleash unlicensed ungulates!
User avatar
dennisw
 
Posts: 438
Joined: Wed Nov 05, 2008 9:09 am UTC
Location: Appearing pro se AND pro bono!

PreviousNext

Return to Individual XKCD Comic Threads

Who is online

Users browsing this forum: bonsaipark, Himme, quantropy, Yahoo [Bot], ZoomanSP and 19 guests