News for hackers. Stuff that matters.
Re:Why programming is a good medium for expressing poorly un... by mrfusion on Saturday January 23, 2016 @09:40PM (#10961219)
I'd love if all the formulas on Wikipedia were written as pseudo code with meaningful variable names. I'd understand them so much faster.
Re:Why programming is a good medium for expressing poorly un... by moultano on Saturday January 23, 2016 @10:20PM (#10961316)
Seriously! Any programmer would get pilloried for working solely in single letter variable names. It's so tedious that this is the norm in math.
Re:Why programming is a good medium for expressing poorly un... by vlasev on Sunday January 24, 2016 @04:43AM (#10962073)
The purpose is completely different! Here's one of several important reasons.

You wouldn't survive doing math with longer variable names. Imagine yourself writing "time" every time you need to write it in a formula in the course of a working on a problem. Just expand the following expression (time + 2)(2time - 3)(4time + 5) by hand, writing "time" every time. Or imagine studying vector calculus and writing out the formulas with the long names like "grad", "curl", etc. That kind of notation was replaces with the nabla symbol and overloaded notation for a very good reason.

Also, most derivations, for simple formulas even, go through larger complexities before they converge to something slick. Take a look at the derivation of the Navier-Stokes equations [1] and see if you could have done the same thing with longer variable, function and operator names.

So yea, it all boils down to repetition and quantity.

[1]: https://en.wikipedia.org/wiki/Derivation_of_the_Navier%E2%80...

Re:Why programming is a good medium for expressing poorly un... by wtallis on Saturday January 23, 2016 @11:40PM (#10961495)
I think it's largely because the long-standing mathematical tradition comes from an era where those formulas always had plenty of context, be it that of a topic-specific class/lecture or a paper that is published in a journal with a particular focus. Once you know what field of mathematics you're dealing with, there are strong conventions for what variables mean what; that's one of the things that has let to mathematics drawing from so many alphabets. It's only been with relatively recent advances in information technology that the highly technical details of many specialties have been aggregated closely enough for the context to be lost.

Also, long variable names would greatly obscure the overall structure of many formulas, which could be an even bigger problem.

Re:Why programming is a good medium for expressing poorly un... by narrator on Sunday January 24, 2016 @12:55AM (#10961652)
I think that the short variable names in math come from the time when these things had to be written out in long hand on blackboards. You ever see old sci-fi movies, like "The Day The Earth Stood Still" where professors are working out ideas on huge blackboards? Having long variable names wouldn't fit on the blackboard and would be slow and hurt your hands.
Re:Why programming is a good medium for expressing poorly un... by wtallis on Sunday January 24, 2016 @02:33AM (#10961836)
The lack of an efficient IME for verbose math input on a computer certainly accounts for why math is still terse when done in real-time such as when extemporaneous lectures or when working something out. But I don't think it fully explains why the convention persists even in published works that took months or years to prepare; there's got to be a significant effect for the readers and not just the writers. If a longhand style of presentation were as clearly superior for mathematics as for software source code, one probably would have caught on by now.
Re:Why programming is a good medium for expressing poorly un... by narrator on Sunday January 24, 2016 @03:06AM (#10961899)
It's probably just the weight of tradition from the longhand days that leads people to use the short variable names, not that it's somehow better, even on a computer.

All it would probably take would be for someone to start a math journal that required a minimum of three letter variable names and everyone would switch over.

Re:Why programming is a good medium for expressing poorly un... by GFK_of_xmaspast on Sunday January 24, 2016 @11:02AM (#10962850)
Who would want to submit to such a journal?
Re:Why programming is a good medium for expressing poorly un... by bitwize on Sunday January 24, 2016 @03:52AM (#10961976)
And then they run out of Latin letters so they switch to Greek. Then they run out of Greek letters so they switch to Hebrew...

You have to remember that math is written for the sake of mathematicians' brains, not for the sake of dumb machines which accept only linear strings of a limited character set through a teletype. A mathematician can look at a formula and subconsciously break it down into constituent parts based on its shape. Multi-letter (word? phrase?) variable names would only serve to add unnecessary clutter and obscure the shape of the formula. Meaningfulness of names is a secondary concern, if it is a concern at all; meaning can be established in the text surrounding the formulas or equations; and if things indeed get too complex for a set of a few formulas, the option is always there to switch representations -- to computer code or pseudocode.

Re:Why programming is a good medium for expressing poorly un... by vlasev on Sunday January 24, 2016 @04:46AM (#10962079)
Also, mathematics' naming conventions are quite strict.

The nabla symbol is almost-exclusively used for vector-calculus operations. The letters t, s, u, v are almost-always used for parametrizations. The letters i, j, k, n, m are usually used as indices of summations. We can go on.

Re:Why programming is a good medium for expressing poorly un... by weinzierl on Sunday January 24, 2016 @04:04AM (#10962000)
I think I've never seen Hebrew. Or maybe I've seen it and didn't recognize it as Hebrew. Do you have an example?
Re:Why programming is a good medium for expressing poorly un... by vlasev on Sunday January 24, 2016 @04:43AM (#10962074)
Re:Why programming is a good medium for expressing poorly un... by dagw on Sunday January 24, 2016 @08:27AM (#10962428)
There are also Beth numbers (https://en.wikipedia.org/wiki/Beth_number), closely related to Aleph numbers, but as far as I know that is the only place hebrew letters show up in mathematics.
Re:Why programming is a good medium for expressing poorly un... by collyw on Sunday January 24, 2016 @09:56AM (#10962649)
Your comment just made me realise why I hate any hackerrank "challenges" I have looked at. (Skyscanner uses them for interview tests, I have been close to applying twice, but got offered other jobs before I got around to completing them).

I have decided to try a warm up exercises a couple of times before applying but the way they word the questions is so unmeaningful: 'n' lines with y variables, plus spending 20 minutes trying to work out how to read their input. No debugger and not easy way to cut and paste, as its all in a web form.

Fuck that, I am a software engineer, I usually read data from databases and name my variables properly and use tools to help me understand the problem, not hinder myself.

Re:Why programming is a good medium for expressing poorly un... by wott on Sunday January 24, 2016 @12:00PM (#10963036)
All right, so nowadays software engineers cannot read specifications, cannot program and correct their mistake without a debugger, cannot do anything without an IDE, cannot do anything without copy-pasting (from SO) and read their data from a database.

Jesus, please send me back to XXth century.

Re:Why programming is a good medium for expressing poorly un... by collyw on Sunday January 24, 2016 @10:06PM (#10965336)
Sure I can but I don't have an hour and a half time limit on it under normal circumstances.

You want me to do something in a rush give me the tools I am used to. Should I code in C rather than python just to prove I can?

Re:Why programming is a good medium for expressing poorly un... by kyllo on Sunday January 24, 2016 @12:40AM (#10961617)
Any programmer except a Haskell programmer.
Re:Why programming is a good medium for expressing poorly un... by eru on Sunday January 24, 2016 @05:54AM (#10962170)
And for the same reasons: some things are so abstract, that there's not really a better name for them than line-noise symbols.
Re:Why programming is a good medium for expressing poorly un... by eru on Sunday January 24, 2016 @05:51AM (#10962166)
And in Haskell. At least for the more abstract bits of code.
Re:Why programming is a good medium for expressing poorly un... by contravariant on Saturday January 23, 2016 @10:19PM (#10961312)
I don't think that's possible for most of them. Quite a few formulas aren't equivalent to any one program, and most variables don't have a fixed meaning.

Can't really think of one that could be improved by writing it as pseudo code.

Re:Why programming is a good medium for expressing poorly un... by weinzierl on Sunday January 24, 2016 @03:55AM (#10961987)
> I don't think that's possible for most of them. Quite a few formulas aren't equivalent to any one program,

Even every proof can be expressed as a program, see Curry–Howard correspondence [1].

> and most variables don't have a fixed meaning.

I think this is kind of the point of the original comment. For a physicist PV=nRT is concise and clear but for everyone else? The letters P, V, n, R, T can have many meanings but in the context of this formula their meaning is fixed. Why not write:

    pressure * volume = AVOGADRO * BOLTZMAN * temperature
> Can't really think of one that could be improved by writing it as pseudo code.

See example above, but I think it strongly depends on what one is familiar with.

[1] https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspon...

Re:Why programming is a good medium for expressing poorly un... by contravariant on Sunday January 24, 2016 @11:09AM (#10962877)
>Even every proof can be expressed as a program, see Curry–Howard correspondence

Well, that is true, but that's still pretty far removed from any common programming language. And readability doesn't usually improve.

>For a physicist PV=nRT is concise and clear but for everyone else?

You've somewhat got a point there, physics would be a lot easier if all formulas and variables were actually defined when needed. But symbolic notation is still a necessity, simply because symbolic manipulation is really powerful, and it's a pain to have to write 'BOLTZMAN_CONSTANT' every single time, instead of just k_B.

Also, your notation might work for simple equations like the ideal gas equation, but an equation that's only slightly more complicated, the van der Waals equation, would become quite hideous:

    (pressure + number_of_particles^2 * attraction / volume^2) * (volume / number_of_particles + excluded_volume) == BOLTZMANN_CONSTANT * number_of_particles * temperature
I really wouldn't want to have to write that out several times just to do some calculations with it.
Re:Why programming is a good medium for expressing poorly un... by vlasev on Sunday January 24, 2016 @04:31AM (#10962054)
There are a lot of conventions in physics and math and they come to the rescue. In the CONTEXT of gases, it's easy to realize that V must be volume, T must be temperature, etc. The formula PV = nRT is for physicists, not for "anyone else".