Monday, February 27, 2006

Divide & Conquer

A good friend of mine sent me (sometime back in '05) a link to the complexification gallery of computation. The site is loaded with plenty of amazing, mathematically complex computer-generated art. Being a hobbiest musician and a computer science guy that likes math, I was really impressed and inspired at the same time. As it turns out, some of the art there was done using Processing, and some other using Macromedia's flash technology. I decided to give Processing a try, just because it would be easier for me since I already knew my way around Java.

Jared Tarbell has published most (if not all) of his Processing source code generating his art published in the complexification website, so I decided to take a look at it and start playing around.

After looking at Jared's code, I went on to the Processing manual and examples and understood a bit more of what was going on. That led to some extra inspiration since I could see how the Processing source code was suddenly combining math and art. Somewhere in between all that, I remember having more or less the following thinking:

"... hmm ... I know I can't paint any art in real life ... (even the technical drawings I had to go through during my Engineering studies were very hard for me!) ... so this is cool, I can do the computer paint for me ... " and then "... OK, so how am I gonna fill in the frame?". That's where recursion and divide & conquer came to my mind.

Divide and Conquer is a computer science algorithm design and problem solving technique derived from other fields (war and military strategy, politics, economics, etc). The general idea behind it is that given a complex or large problem, one could try to break it into several n smaller or simpler (but similar in nature) problems. This same technique can be then applied again to this new smaller problems, and so and so on (this is called recursion)... until the problems are simple or small enough so that we know how to solve them. Once we solve the little problems, the sometimes hard part starts where we need to (step by step) re-combine their solutions to come up with the solution to our initial problem.

Well... I just did that with the painting. I didn't have any idea what to paint, so I decided to break the problem into painting smaller boxes. Then I applied recursion, until the boxes were small enough so that I actually had an idea of what I wanted to do with them. And then I recombined them. So this brought up a small Processing program that leads to graphics such as:



Austin has a great lake, very nice golf courses and good food. I like all three things :-). So I've taken a picture showing red apples, another one from a nice golf course and one from a sky and lake sight. They are not necessarily from Austin, but they are equally inspiring. Going forward and combining some randomness with these colors, I came up with plenty of different frames.

Once I had all those small boxes (actually, 24 of them, 8 per color), I wanted to jump back one more step from recursion and make up a bigger frame out of them.

This led to the next math-related inspiration: the four-color theorem. This problem has a fascinating history behind. Anyway, I only had 3 colors. I have (manually) arranged the boxes "a gusto y piacere", but taking care that one given box never touches another box of the same color. I've also grouped them in 3 rows, 8 boxes per row, and where each color has at least 2 boxes per row. This has few solutions, but I've chosen:

red -apples- : (3, 3, 2)
blue -lake- : (3, 2, 3)
green -golf- : (2, 3, 3)

[wait... that looks like a matrix :-). Oh well... that might be the starting point for my next try...]

Then I've added some transparency. And voila, here is my first computer-generated graphics "art", which I call, of course, "Divide and Conquer" oh ... wait ... shall I call it my first "test"? :-)

Monday, February 20, 2006

Test song

I know, I know... I haven't blogged in a while. One of the reasons behind this is that I've been busy setting up (one more time) my small digital home studio.

The studio is not yet 100% set up. However, I've found that this is generally the case. I'm always connecting things some different way, changing, updating or adding hardware, breaking things, moving things around, unplugging cables, etc. So since I don't spend that much time on it, I've learnt to accept that its good enough if it works :-)

After some hard work (even if I enjoy working on it), its always good to have fun. So I've decided to do a small test song to try out my new setup. It took me about 14 hours to compose, record and mix it. That's very fast (at least for me) on a new setup and for a 3.5 minutes long song, and that's why it is a test song ... so don't expect anything great, OK ? :-). Wow, that was a good excuse. Now seriously... I need to work more on the melody and the harmony (and the intro, and the end, and ...), but just wanted to record a test song anyway.

OK, enough words, hear it (once you click on this link, follow the "click here to download" link at the bottom of their page -you might need to wait a few seconds for the link to appear-) at your own risk :-). After listening to myself a few times, I don't really like the song a lot, but I can still recognize the influence of some bands I like, mostly:

Dream Theater
Kitaro
Tony Macalpine
Yngwie Malmsteen
Deep Purple

Oh ... and, by the way... here are some pictures of the studio (yes, while editing this post! ha ha ... can you read this? try harder :-)


















I hope to be blogging again soon. May be I'll have some good (better?) song next time! :-).

Thursday, February 02, 2006

Peak Oil

On the first year of my Computer Engineering studies at ITBA, I took the "Formacion General" coursework, which I'd translate into "General Knowledge". Altough this was regarded as an easy, general course among the young students, I've always enjoyed those classes and pay special attention to Professor Roberto Devoto crystal-clear, inspiring insights on diverse topics such as history and society, economics, politics, engineering, manufacturing, technology, etc. A few years later, I would become one of his teacher assistants in the Discrete Mathematics course -for which I'm extremelly grateful-.

Anyway, I still remember going through some basic mathematical world population growth models (see Thomas Malthus). We also went through the different energy sources and their role in our modern-world economics. I remember thinking about the Malthusian catasthrophe, ultimately relating it to the problem of using non-reusable energy sources as the foundation for our modern-world economy.

I was very excited about learning all this, but I was also a bit worried about our future. Now almost 10 years later, a very good friend of mine just sent me this link:

http://www.lifeaftertheoilcrash.net/

Few days ago, President George W. Bush has addressed this in the State of the Union:

" ... Keeping America competitive requires affordable energy. And here we have a serious problem: America is addicted to oil, which is often imported from unstable parts of the world. The best way to break this addiction is through technology. Since 2001, we have spent nearly $10 billion to develop cleaner, cheaper, and more reliable alternative energy sources -- and we are on the threshold of incredible advances.

So tonight, I announce the Advanced Energy Initiative -- a 22-percent increase in clean-energy research -- at the Department of Energy, to push for breakthroughs in two vital areas. To change how we power our homes and offices, we will invest more in zero-emission coal-fired plants, revolutionary solar and wind technologies, and clean, safe nuclear energy. (Applause.)

We must also change how we power our automobiles. We will increase our research in better batteries for hybrid and electric cars, and in pollution-free cars that run on hydrogen. We'll also fund additional research in cutting-edge methods of producing ethanol, not just from corn, but from wood chips and stalks, or switch grass. Our goal is to make this new kind of ethanol practical and competitive within six years. (Applause.)

Breakthroughs on this and other new technologies will help us reach another great goal: to replace more than 75 percent of our oil imports from the Middle East by 2025. (Applause.) By applying the talent and technology of America, this country can dramatically improve our environment, move beyond a petroleum-based economy, and make our dependence on Middle Eastern oil a thing of the past. (Applause.)

And to keep America competitive, one commitment is necessary above all: We must continue to lead the world in human talent and creativity..."

When I read this last phrase on human talent and creativity, my brain goes back to Roberto's teaching methods.

It seems we haven't advanced much on this problem for the last decade. This is really sad and I recognize this is tough material, but that's exactly what makes it so important for us to try to be smarter and do something about it.