Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: OT: Mathematics for programming (again)

by BrowserUk (Pope)
on Sep 10, 2008 at 23:00 UTC ( #710485=note: print w/replies, xml ) Need Help??

in reply to OT: Mathematics for programming (again)

Given a sorted array and a value we know is in it, why can we know for sure that if we search it in linear order starting at the beginning, we will eventually always find the value at some index?

Because we know it will. How would having a proof of that help a programmer?

but the mythical algebra could be built on simple theorems like this, much like Eucledian geometry, and then expanded to cover deeper and more meaningful theorems.

When someone shows me how math can help me write code to deal with

  1. interferance from an unseen lift motor in the building next door, that only happens on Teusday mornings(*), at one installation site out of 300, that causes my serial port server to loose data.

    *Because that's when the shop next door took delivery of it's peanuts, which being very dense meant it was easy to overload the freight lift and cause the motor to arc.

  2. Or defend against the correct data being supplied in the wrong units.
  3. Or users entering "VISA" in the field labelled "name on the card".
  4. Or a 4GB XML file with mismatched tags.

Math theorems tend to only work under very specific sets of assumables, which real-world code rarely enjoys.

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: OT: Mathematics for programming (again)
by amarquis (Curate) on Sep 11, 2008 at 14:26 UTC

    I mostly agree with you.

    The connection to physics in the OP is apropos. Physics straddles the line between mathematical purity and empirical data, and sometimes you have to give up some elegance and do some hand waving to get stuff done in the real world.

    Similarly, in programming we deal with real world events that hamper our ability to make assumptions, like BrowserUK's lift motor. I spend much more of my time defending against those events (customers entering VISA in the "name on card" field, customers putting URLs in the search box, etc.) than I do contemplating the lack of rigorous mathematical backing of my actions.

    But, I don't feel like the study of "the algebra of programming" is useless to me, even if I don't care about it. As a physics major I really disliked mathematics but it provided me the tools to get the job done. As a programmer, do I care much about this subject? Not really, but I know that work in this direction will inform the tools I'll be using to program 20 years from now.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://710485]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2017-10-21 02:26 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (269 votes). Check out past polls.