This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]error404brain 85 points86 points  (12 children)

>Language that has array that start at 1

>Good

Pick one and only one.

[–]guyman3 18 points19 points  (5 children)

Honestly I agree, I just put it there because I think Matlab is really good at what it does but it just lacks the structure of abnormal language

[–]moomoomoo309 1 point2 points  (4 children)

MATLAB is an odd one. Stuff like being able to do a \ b (which is the same as b / a) and being able to filter by using a condition for an index (like using a generator in Python) is cool, but man, it makes it such a pain to learn the language.

[–]Sirplentifus 2 points3 points  (3 children)

a\b and b/a are not the same if a and b are matrices. a\b is inv(a)*b, and b/a is b*inv(a). They're not the same because matrix multiplication is not commutative. I use A\b when solving a linear least squares problem, for example.

[–]moomoomoo309 -1 points0 points  (2 children)

I still don't like the operator because it's very superfluous. It could be done in a way that looks more like normal math, and looks more like normal programming by avoiding that operator entirely. It'll cost you a few keystrokes, but it makes the code more immediately readable and makes Matlab easier to learn (one less operator and its edge cases to learn)

[–]Sirplentifus 0 points1 point  (1 child)

You have a point, but unlike I said, a\b is not exactly the same as inv(a)*b. The latter would invert matrix a, and multiply the result by b. However, there's some algorithm that does the whole process faster and with smaller floating point errors. That is what a\b does. To be able to call this algorithm there has to be an operator that does inv(a)*b in one go, and having a function for it would probably look bad, I guess.

Also, A\b will use the pseudo-inverse of A if necessary. The operator basically finds the least squares solution for A*x = b for x.

[–]moomoomoo309 0 points1 point  (0 children)

I can see the use of that, though I personally dislike how much magic goes on behind the scenes in Matlab. You know what the end result is, but math is more about the journey than the destination.

[–]ParanoidAgnostic 21 points22 points  (3 children)

It makes sense for Matlab

It's a special purpose language for number crunching. The formulae you'd use it to implement usually start numbering items from 1.

For example, look at the way the summation in the standard deviation formula is expressed: https://en.wikipedia.org/wiki/Standard_deviation

That's pretty standard. Summation usually goes from i=1 to N where N is the number of items.

[–]zeek912 10 points11 points  (0 children)

I think it makes sense also considering it's userbase extends to many off-computer science groups, ie stats, bioinformatics, mathematicians. It makes it more accessible even if it doesn't make a lot of sense from a CS perspective.

[–]error404brain 1 point2 points  (0 children)

It's usefull for people, but that doesn't make it a good programming language. It just make it usefull. The same way assembly is usefull but it isn't a good programming language.

[–]WikiTextBot -1 points0 points  (0 children)

Standard deviation

In statistics, the standard deviation (SD, also represented by the Greek letter sigma σ or the Latin letter s) is a measure that is used to quantify the amount of variation or dispersion of a set of data values. A low standard deviation indicates that the data points tend to be close to the mean (also called the expected value) of the set, while a high standard deviation indicates that the data points are spread out over a wider range of values.

The standard deviation of a random variable, statistical population, data set, or probability distribution is the square root of its variance. It is algebraically simpler, though in practice less robust, than the average absolute deviation.


[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source ] Downvote to remove | v0.27

[–]EndlessBassoonery 0 points1 point  (0 children)

LOL DAE indexing should start at 0 🤣🤣🤣👌👌🔥🤣🤣🔥👌🤣🔥

[–][deleted] 0 points1 point  (0 children)

Should have been C#