4 ms·
var distance = sqrt(x * x + y * y) That is something very similar they may had in high school.
by dvh 4y ago
var distance = sqrt(x * x + y * y)
That is something very similar they may had in high school.
- tasuki 4y agoMath notation is familiar, yes. Are you also saying math notation is good? Is it an example to emulate? I always thought math notation was atrocious to the point of discouraging me from the subject. Who knows, had mathematics used saner (simpler, consistent, perhaps slightly more verbose) notation, I might've been better at it.
- andsoitis 4y ago> Are you also saying math notation is good? If mathematics notation were as terrible, horrible ad you say, wouldn’t mathematicians have changed it by now?
- gus_massa 4y agoMath notation is terrible! I write like 4 or 6 midterms for Algebra and Calculus for the first year in the university. We are using LaTeX (for most of them), but we need to write LaTeX assuming the copy machine is not very well maintained. For example, we can't write $e^{-\frac{x}{2}}$ because the minus and the bar of the fraction may not be clearly separated. Also x and 2 will be too small. A solution is to use \dfrac to make them bigger, but the 2D structure of the formula will make the e and 2 be too close and confusing. After some year of trying, one of my coworkers insisted in using $e^{-x/2}$ that is ugly but copy-machine-poof. We also need huge integrals for $\int_0^7\dfrac{1}{1+x^2}\ dx$. The standard one is too small. I tried to write a macro for that, but the 0 and the 7 must be in weird positions. Also, there are too many cases, because the limits may be missing. Finally, we are using https://ctan.org/tex-archive/macros/latex/contrib/bigints https://ctan.org/tex-archive/macros/latex/contrib/bigints with some tiny macro to rename it to \lint because I don't like the names the author used. The math notation is very good to write in dead tree paper with a pencil in 2D, but in 1D with a keyboard or automatic processing is horrible.
- wheelerof4te 4y agoLiterally a one-liner that is way more readable than whatever that was in the OP example.
- xigoi 4y agoMath notation also features one-letter variable names, weak typing and lots of ambiguity. Do you want those in code?
- eimrine 4y ago> weak typing Let me disagree! The type is always one, Number (not Int or Float).
- xigoi 4y agoNo. There are several numeric types: ℕ, ℤ, ℚ, ℝ, ℂ, … However, mathematicians nearly always implicitly convert between them because having explicit conversions all over the place would be extremely annoying and useless.