The Computer and the Perfect Pie, (Slice A)

Let’s say that an Algorithm is like a pie recipe.

You really want to make someone you love a good pie,to match his or hers perfect taste right?

well let’s assume you don’t really know his or hers taste…

What do you do?

Well you could go here,Ā  but let’s assume that you don’t šŸ™‚

So…

There are two (more) ways to make the pie perfect his or hers perfect taste.

The first is to make every possible pie in the world!

Every possible pie (well,,, many :))

on one just a tad more sugar, on the other one cherry more. there are a lot of combinations, really.

sounds a bit crazy?

Well that’s what happens when you let a computer make a pie.

OK, not always, just when the programmer tells it to do it.

This ‘try everything until it’s perfect’ is called “Brute Force Search” and sometimes it even works in a reasonable amount of time.

that’s because computers, while not naturally good chefs, can “cook” very very fast.

The other option is cooking like most people (who don’t run 5 stars restaurants) do –

You try several recipes, and ask your loved one “did you love the Fresh Strawberry Pie more than theĀ  Chocolate Bourbon Walnut Pie” ?

and then, and this is where the fun starts, your change the recipe!

For example, you conclude that Strawberry is the thing, so you do two strawberry pies, with slight differences, and ask “Did you love the Fresh Strawberry Pie more than the Strawberry-Rhubarb Pie ?”

and after several of this steps, you reach the perfect (or good enough) taste! (or can’t look at pies anymore, either way, after finite amount of steps, the process ends :))

Now this kind of process is usually faster then “Brute Force Search” as you usually don’t try every possibility, for example, if the taster preferred strawberry over Chocolate you won’t try every otherĀ  Chocolate flavor right? just try strawberry, right?

(by the way, you could be wrong about this, and the taster may only like one specific Chocolate pie, much more than any other kind of pie, but prefers strawberry over other less desired types of chocolate pies, it’s a problem with this process, especially with people with odd tastes, so with them you’ll probably have to settle for ‘very good’ instead of ‘perfect’, or try many combinations… :))

That method of work, in which you try something, get a score about the quality of your answer, and than retry is well it’s Trail and Error, but it’s more than that, basically you had the following steps:

* choose pies. (Random phase), this is done only once at start.

The number of pies is called the “population” number.

* taster grades pies. (Grading phase)

* Throw away low graded pies.

* Keep some high graded pies (well at least their recipes) at the side.

* Mix high graded pies (if both cherry pie and apple pie got high grade, try a cherry+apple pie!). (Both previous steps are the “Breed phase” – high graded pies breed with each other, bringing little cherry+apple pie or some other breed, lower graded pies will have low chances to breed…)

(* Taste good graded pies, because they should taste good `))

* Change a bit the high graded pies (Mutation phase), maybe change some quantities or add someĀ  Brazilian nuts!

* Repeat the process (from the second step) until score == 100 (for perfect) or until score is higher than (score enough to make taster happy, yet amount of tries less than needed to make the chef angry), every repeat is a “new generation” of pies.

Not every chef will do every step, maybe some chef will use just one cake and modify it on every

“generation”, that is have aĀ  population of 1, and doing just the Grading, and Mutation phases (and well maybe “keeping good recipes” phase) others, life food companies and highly patient mothers, will do some more, but all of this is what is called in Computer Science a Genetic Algorithm.

Yes, there is an entire field on how to make good pies. (ignore the ‘computer’ part, really)

Well not just pies, or even pies recipes, but all kind of recipes. and even on recipes for how to make better recipes (here a recipe called Genetic Algorithm for making better pie recipes).

I hope to discuss it some more, but not until I get some pie! :).

PS you aren’t suppose to write about Computer Science and pies without mentioning Pi but I managed! No wait…

Mathematics is a part of physics.

“Mathematics is a part of physics. Physics is an experimental science, a part of natural science. Mathematics is the part of physics where experiments are cheap.”
Palais de Decouverte,in Paris on 7 March 1997,Ā  from ‘On teaching mathematics’ by V.I arnold
Presents an approachĀ whereas math should be strongly related to physics and to the “natural world”. true or not this approach does come with has some educational benefits, makingĀ  illustrations easy and well… natural.
This article started Sujit Nair’s project of translating ‘Abel’s Theorem in Problems & Solutions.‘.

Why you shouldn’t upgrade.

It was some time ago, I was cleaning, and like anyone who cleans (and judges a book by his weight), I throw away the old (and heavy keyboard) and kept the new.

Some years later I was talking to my cousin, and he was talking about those old-school keyboards, and I said “Yes I had one of those, I throw it away…”.

After forgetting his look of contempt, I came to several realizations:

  • There are cases in which the old is better than the new.

Which brings me to the point:

As consumers, we sometimes have this naive believe that manufactures (including software manufactures) build newer version to make our life better.

Manufactures sometimes (always) produce a new version for the following reasons:

  • To reduce costs – on the first product version, on-time-delivery was all that mattered, but after that, the manufacture teams will circle like eagles around expensive parts, trying replace them with cheaper ones to “do the same thing” for more profit. they won’t usually care if the cheaper parts are shiny, smooth or fun.
  • Eliminate a feature (you like) that gives the company too much headache and not enough money,
  • Insert a new feature that may give the company money and annoyance to you. (replace “money” with “alignment to long tern vision” for open-source projects)
  • To fix big bugs, or implement features you want. good sign that such improvements are coming, is that you and most users aren’t happy with the buggy and lacking product, or that the product is in a very tough market competition (or on the rare cases – that the manufactures really love their product, and probably use it on a daily basis, with no corporation limitations preventing them from being glorious, like DragonFlyBSD or VIM).

Also on a new version you have the risks of new and interesting bugs, not (only?) the bugs you came to love and live with, but new ones that will cost you new time to workaround.

So basically you have two kinds of products:

  • Products which don’t get better in time – old mechanical wanders like dish-washers, ,washing machines, good music and 5 more items that are better old than new.
  • Products that do get better in time, notĀ necessarily from one version the next, but definitely after many versions, when new technology both finds its way in, and had enough time to be stabled.

So if you are generally happy with your product, my advice isĀ  – don’t upgrade! (not including security updates)

Wait for a decade or two (well maybe several years) and while you’re at it, hear some good old music šŸ™‚

Update 23.5.2013:Ā  I allowed my Linux to self-upgrade itself, now the Virtual Machines I have inside it won’t start claiming some kernel driver isn’t installed. I knew I was right about this don’t upgrade thing… `)

Cool things to spend time on


(Please add your list below!)

Drawing blogs

  • Kelley McMorris:

http://kmcmorris.blogspot.co.il/

http://drawworm.blogspot.co.il/

  • Sam Nielson:

http://artsammich.blogspot.co.il/

Lipdubs (what’s a lipdub?)

Riddles

Different levels:

Hard:

Specific riddles:

Comics

PHD