4 ms·
The difference is that form is important in mathematics and not very important in programming. Therefore symbols are used because it makes it easier for the eye
by yellowcake0 5y ago
The difference is that form is important in mathematics and not very important in programming. Therefore symbols are used because it makes it easier for the eye to recognize patterns.
For example these equations look similar,
x^2+4x+5=0
y"+4y'+5=0
Even though one is a polynomial equation and the other is a differential equation, the common visual pattern suggests that the techniques needed to solve them may be similar.
On the other hand in programming there's no need to do this, all the math has already been worked out on paper, so it's better to use clear, distinct, easy to type variable names.
- Buttons840 5y ago> form is important in mathematics and not very important in programming How important is form when I'm programming mathematics?
- yellowcake0 5y ago> How important is form when I'm programming mathematics? Not important.
- eigenspace 5y agoAs a physicist who does a lot of mathematical programming for my every day job, I'm going to disagree pretty hard.
- yellowcake0 5y agoWith how I've defined form, I'm not sure how you could. Who in their right mind does math on a computer, math is implemented on a computer, but it's done by hand.
- eigenspace 5y ago> Who in their right mind does math on a computer, math is implemented on a computer, but it's done by hand. Maybe you think this becuase your used to writing math on computers that make writing that math ugly and obtuse? Besides, having the math you've written by hand closely match the syntax you use on the computer can greatly reduce the cognitive burden of switching between code and paper.
- yellowcake0 5y agoI'll just make one brief comment in regard to wanting the math you've written by hand to closely match the syntax on the computer, and say that this is rarely the correct thing to do when writing high quality numerical software. Making your code performant, and doing a thorough numerical analysis, usually requires a significant rearrangement of your formulae.
- plafl 5y agoI'm sure there is so much room for improvement here. The closest thing for me is using TeXmacs: https://m.youtube.com/watch?v=H46ON2FB30U https://m.youtube.com/watch?v=H46ON2FB30U
- jokteur 5y agoUsually, the formulas I derive on paper end up quite complicated and can not be simplified away. When I am numerically implementing the formula, I want that it matches closely what I wrote in the paper, and long variable names would make my code less clear mathematically. Why would I use the variable name "probability_distribution_on_m" instead of "rho_m", when I know all along what rho_m means in the contexte of my code (the symbol use throughout the paper). Usually, I comment at the beginning and specify what the variables mean and to what they correspond in the paper. And if somebody needs to read my code, that person will need to understand the paper first. More descriptive variable names won't make the person understand the paper better. Of course, when I am writing some non-scientific software, I will use descriptive variable names, because there is no complicated formula, no paper that sets the context of the code, and it makes sense in general to have descriptive variables for logic elements for a clear code.
- yellowcake0 5y agoI didn't say to make your variable names verbose. rho_m is fine in my opinion, although I find it strange that you would name a probability distribution rho unless it's a density matrix. I would probably name it prob_dist_m, or even pdist_m if you want to be more terse. What I do think is bad form would be naming it ρ_m.