3 ms·
How about Gauss’s distribution’s density function? Or a numerically stable version of a simpler formula? Also, you forgot the usual case of implementing a white
by kaba0 5y ago
How about Gauss’s distribution’s density function? Or a numerically stable version of a simpler formula? Also, you forgot the usual case of implementing a whitepaper with mathematical notation. It is much easier to proof read that, when you copy largely the same in your program as well. And if you pass in the readable energy, mass, etc variables, inside the function you can use the domain-specific mathematical notation. That way it will be readable both outside and inside.
- kennywinker 5y agoI think we might be arguing different points. I'm not saying use different variable names from the canonical math version - I'm saying the canonical math version should use variable names instead of symbols. So per your point - I'm not qualified to re-define mathematical notation so I won't go very far with it, but taking the formula you mentioned, Gaussian distribution density function (not focusing on the fact that I had to re-write it in pseudocode to represent it in a text format): f(x) = 1/(σ * sqrt(2*pi))*e^(-1/2*((x-μ)/σ)^2) I would suggest a couple changes: - change σ to `standard_deviation`, or if you don't like snake_case I could handle `stddev` - change μ to `mean`. - change x to `input` - there may be a better name than that, and x is pretty widely used in math so I'm not married to this one. - e should probably stay the same - e means e no matter the mathematical context, while μ means different things in different fields of math. f(input) = 1/(standard_deviation * sqrt(2*pi))*e^(-1/2*((input-mean)/standard_deviation)^2) This doesn't make it more or less readable, but it does mean I don't have to _just know_ or look up that μ is `mean` to parse it.
- kaba0 5y agoI accept your position, and perhaps my examples for a difficult formula was not difficult enough — my point is more along the line that the underlying structure of a formula becomes more easily visible with shorter symbols — and for syntactic manipulation one can more easily see patterns emerge.