News for hackers. Stuff that matters.
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".