epsilondelta.wordpress.com — This is the start of a new series, “Programming Like A Mathematician”. The author will explain how a mathematician thinks about a particular problem, with hopes that programmers will be able to see things from a different perspective.
Jan 31, 2006 View in Crawl 4
mellertimeJan 31, 2006
I think that's my liquified brain drooling out of my ears...
oepapelJan 31, 2006
"It would probably be better to do it the way you suggest, but for now I find that it's easier to find problems with simple but well-documented code rather than hunting down the relevant parts of code amongst a bunch of error-checking code. When/if I have to scale things up, I agree that it may be best to impliment these sorts of things, but mathematicians tend to have different needs than most programmers in other fields."I look at it like typing skills. Some people hunt-peck and swear that they can do it faster and better than they ever could touch-typing. And if they can get by with it, then I say good luck and god bless.Those that have gone through the effort of learning touch typing usually hate it while they are learning but, once mastered, they are more efficent than they ever could have been otherwise. It is human nature to take the path of least resistance but that doesn't make it the best path. I think there is enough bad code out there without feeling the need to add to the pile.
pingviiniFeb 1, 2006
The part about programmers needing to be like poets is a great way of saying it. Sometimes I look at my friends code and it looks like a 3rd grader writting poetry. Now the same people are a year or two ahead of me in math, so I don't think that quality is really relevent in math. I think someone good at physics is similar to a good programmer. In physics you have to derive a formula that can do lots of relevent things, and it does it really well. F/ M = Au * Fn = Ffmount ls Simple, elegant, poetic
oepapelFeb 2, 2006
" Lol I'm not couse i at least inderstand this:"n=100;sum_n = ((n + 1) * (n)) / 2;and you dont :)"Ok, smartguy, here's a derivation of the formula:Deriving a non-recursive formula for Sum(n):When n is even: Generate standard expansion to be simplified Sum(n) = 1+2+3+....+(n/2)+(n/2+1)+....+(n-3)+(n-2)+(n-1)+n Rearrange in pairs (first + last, second + second-last, etc.) Sum(n) = (1+n) + (2+(n-1)) + (3+(n-2)) +........+ (n/2+(n/2+1)) Simplify each grouping (for n items, there are n/2 groupings) Sum(n) = (n+1) + (n+1) + (n+1) + .... + (n+1) Sum(n) = (n/2) * (n+1)When n is odd: The sum can be expressed as an odd value added to an even sum Sum(n) = n + Sum(n-1) ( where n-1 is even, so we can use our previous results) Sum(n) = n + ((n-1)/2)*n Convert to a common base, expand the terms and add together Sum(n) = (2n + n*(n-1)) / 2 Sum(n) = (2n + (n^2 - n)) / 2 Sum(n) = (n^2 + n) / 2 Rearrange to match the previous results when n was even Sum(n) = (n * (n+1)) / 2 Sum(n) = (n/2) * (n+1)Therefore the same formula works when n is even or odd.Math is easy.
oepapelFeb 3, 2006
"I agree with you that math isn't only thing that is important to be a good programmer. But it sure doesn't hurt. So why are we fighting? "By that same logic, knowing how to flyfish doesn't hurt either and if you are writing software that involves flyfishing then it helps, therefore all programmers should learn the flyfishing approach to programming.How about YOU admit that math is math, programming is programming, and one does not imply anything about the other.
craniumFeb 10, 2006
Where do they get the nerve?80% of programmers aren't really great at programming. Mathematicians are at best "armchair" programmers. Any math major looking for a programming job from me would have a *lot* of persuading to do. It's not so much about implementing simple algorithms as it is about factoring requirements into subsystems and components that make sense. Math is about hindsight, programming is about insight.