I am learning the Ruby programming language. It is probably too early to give any opinions on it.There are some functional programming aspects to Ruby which are quite new to me. For instance, to get the norm of a vector 'v', I could do:
sqrt(v.inject {|s,x| s + x*x})
In a procedural language I would have written a loop. Actually, I would have made a procedure called "norm". I am not sure if one is better than the other. I suppose they both get the job done and both are translated underneath similarly. Maybe one is more succinct, maybe the other is easier to understand. Nevertheless, it makes me think differently. It makes me think more rigorously. The succinctness reminds me of the denseness of mathematical formulations.
A long time ago, I wrote a program to schedule students for classes in a private school. Each student had a list of classes that he or she needed to take. The program tried to arrange classes so that teachers and students had no conflicts. The problem sounds simple enough. It isn't a simple problem, and often there is no solution. Each year it was a headache. A group of teachers would put students names and classes on index cards and start shuffling and scratching their heads.
I guess I wrote the program over the summer. My program would have to run for a couple hours or something if I remember right. I usually get some kind of picture in my head of an algorithm. That algorithm had very long hallways with thousands of doors. And each door opened up into other very long hallways with thousands of doors. There was no chance of taking all the paths. I somehow figured out which doors to take which would most likely lead to a solution.
Often, there was no solution. The program would then have to return multiple non-solutions. It tried its best to find an optimal solution. I believe that it also had settings for breadth of search in the case there was no solution. In other words, you could ask it how many scheduling conflicts were acceptable. since there is a possibility for multiple solutions or nonsolutions, you could also limit that number.
Even with a "solution", it might be sub optimal. No scheduling conflicts, hooray! Joey has mathematics in the morning, no!!!
It was not completely automated. I had to tend to the program. I left the school. That program is on a 5.25" floppy somewhere.
I'm guessing that that program would have been very easy to do in Lisp.
I have sidetracked my self. And now I'm just thinking that I would like to offer a new solution for somebody who is using the equivalent of notecards and scratching their heads.
6 comments:
Great idea! :-) I forgot about that scheduling program!
I have a new painting to put up, but I don't have a camera :(
I also realize that I blog more than the Whitehouse Blog...
And didn't want to put up another post so am writing in this comment box.
Watched Starman tonight. How I hate the 80's synthesizer.
This just made me wonder if you watch that show 'Numbers' that employs a mathematician to solve crimes. On the odd chance you do, do you like it or think it is silly? Just curious!
Great to hear from you, Connie. No, I've never seen it. Sounds interesting though.
Thanks Keith, sorry I have been out of touch for awhile! Here is a link to the show site:
http://www.cbs.com/primetime/numb3rs/
I really like the show and apparently they use real algorithms, but I was wondering how someone who would actually understand the math behind it might think about it!
10:00pm on Friday. Might have to check it out.
Post a Comment