Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

(I assume this was inspired by https://news.ycombinator.com/item?id=16803874)

The use of β€˜=’ for assignment in programming languages comes, not directly from mathematics, but indirectly from the use of mathematics in science and engineering. As an example, consider the formula for kinetic energy, commonly written

        π‘šπ‘£Β²
    𝐾 = ───
         2
Why isn't it written 2K=mvΒ², which expresses the same mathematical equality in a smaller, simpler form? Or any of the other equivalent rearrangements? It's because formulas have a convention, where the LHS is a single term naming the value you want, and the RHS contains the terms for values you have. That is, a formula doesn't just state an equality, it states a method for calculating something. That usage predates programming, and was explicitly copied by early programming languages like For[mula]tran[slator] that were designed for scientific & engineering calculations.



Because I started programming before taking maths at school, I didn't properly appreciate equality for a while.

Sure, algebra was fine, a(x+y)=ax+ay can go either way; but not ratios and other relationships.

What helped me was was geometry, where you can see it's just a relationship. All the components move together; one part isn't priviledged as the result.

e.g. you enlarge a circle. It doesn't make sense to ask whether the radius made the circumference bigger, or the circumference made the radius bigger.


I remember starting with QBasic when I was around 7 or 8 years old, and I quickly got an idea – just put in the equations from math homework to find out the answer! Fighting through the error messages without English and trying to wrap my mind around the basic concepts of procedural programming was a world of pain.


Nice. I had fun in some junior high math competitions in part by writing TI BASIC programs on my calculator to brute force hard problems while I did the easy ones. Eventually they stopped allowing calculators altogether and focused on cheap memorized tricks instead of generalized problem solving.


I'm curious what prompted two people to disagree with this comment so quickly, with no comment.


I didn't downvote, but the reason is likely because your comment is off-topic. The parents are talking about experiences un-learning one-sided equality that they picked up programming before learning algebra; your comment is about programming a T-83 to help with schoolwork.


I believe it comes directly from conventional math exposition. In a general form it’s about emphasis.

β€œThe change of subject from β€œThe dog bit the boy” to β€œthe boy was bitten by the dog” is similar to the change of subject in a formula, as for example … In each case, the two sentences state the same relationship, but with different emphasis.” [1]

[1] https://medium.com/q-e-d/that-loser-woman-mathematician-who-...


Speaking of subject, I find it helpful to have awareness of changes in agent/patient, and not just object/subject:

https://en.wikipedia.org/wiki/Thematic_relation

https://en.wikipedia.org/wiki/Agent_(grammar)

https://en.wikipedia.org/wiki/Patient_(grammar)


Off-topic: how did you format that equation (K = mv^2/2) so nicely? e.g. mv is in italics. It looks really nice.

Does Hacker News have built in LaTeX, or is that just very clever use of Unicode?


Seems to be just unicode in a code block. mv is π‘šπ‘£


And the verbatim lines are explained here:

https://news.ycombinator.com/formatdoc


And two black squares on Firefox beta on my Android 5.1 phone.


Works fine in Firefox Beta (and normal Firefox) on my Android 8 phone.


OK, so fixed in up-to-date Android or with a better vendor (mine is TCL [Alcatel branded]).


While this reasoning may be common, I don't think it's to anyone's benefit. Talking about "the" formula for kinetic energy seems nonsensical, when there are so many ways to state that relationship. Another option is p^2=mK.

But there is a good reason to write it as K=mv^2/2 which has nothing to do with specifying a computation. It is the result of symbolic integration of p=mv with respect to v.


And, perhaps more intuitively, its the second integral of m with respect to v. This pattern also shows up in eg A = βˆ«βˆ«Ο„βˆ‚rΒ² for the area of a circle.


If the expression is supposed to be the definition and not just a derived equality, at least Mathematicians (and some Physicists) would use := instead, just as Niklaus Wirth tried to establish with Pascal.


or ≑


I've only seen that used for congruence (x ≑ y <=> f(x) = f(y), for some context-dependent f).


It used to mean "define" in ancient times.


I'm always asking "why haven't scientists come up with more symbols yet?"

I also ask "why haven't more symbols been introduced to our keyboards? Just !@#$%&*..."

It's strange, esp. when you realize coming up with a new symbol that everyone uses is easier these days than it was 4 centuries ago!


There are many strange symbols in math already that can be difficult to type without something like LaTeX. I feel like something pronounceable is usually better unless you have a sufficiently general idea.


> "why haven't scientists come up with more symbols yet?"

Take an advanced math test and try to type it out. Being in no sense historically limited by typewriters/keyboards, you might be surprised at the complexity of the symbols.


You'd love APL


> It's because formulas have a convention, where the LHS is a single term naming the value you want, and the RHS contains the terms for values you have.

This is simply not true.


I agree this is not entirely true, I have often heard physicists express similar formulas in the way the parent described (I.e. 2K = mv^2)


I've seen that, too, but there is usually a reason for writing it in that form. The most common would be that you have a different equation with 2K in it, and so you want to make variable substitution simpler. Alternatively, if you are reading older papers, typesetting inline equations that don't fit in a single line was painful. For that reason, a formula might be rearranged to avoid needing any fractions.


PV=nRT


While I don’t think the terminology is explicitly standardized, I think most people in the relevant fields would call that statement of the ideal gas law an equation but not a formula, the latter being a special case of the former.


As a trained theoretical physicist, I am entirely unaware of the distinction you are trying to draw here.


Can you find any reference to the idea gas law as a β€œformula?” As far as I can tell, equations without a single variable on the left side are referred to as simply equations, while solutions of such equations in terms of one variable are referred to as formulas. This seems to be the case for every well-known identity I can think of, like the quadratic equation/formula. Can you think of any counterexamples?


https://www.google.com/search?q=formula

Definition 1 ("equation") vs definition 2b ("recipe")

As a theoretical physicist you might find definition 2b uninteresting.


>Why isn't it written 2K=mvΒ², which expresses the same mathematical equality in a smaller, simpler form?

Because you want to find the value of K, which means that if it was expressed thusly, you'll still need to divide by 2 to get to the desired result.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: