I applaud the effort, but I would suggest a different code style if the aim is to make it as friendly and simple as possible.
Specifically, comments every other line quickly add up and take up valuable space. Some, like the one above `sumOfSquares` are, in my opinion, unnecessary. It's obvious from the variable name and that `for` loop what's going on there.
My experience is that the best way to make equations legible is to use their matrix form - matrices are easy to explain to anyone who can add and multiply.
I'm currently in a project that's built around a few calculations and we settled on matrices because it's a language that every team member, from the project owners to developers, understands.
I’m going to disagree. Even code that makes sense when read is easier to read in human language reading through comments. Especially if you’re looking for an area of code you’re not very familiar with.
Comments are basically free in most languages. Use them.
Matrices explain what a function does “literally” (it’s basically a mathematical equivalent to the function itself) but not the why. Comments are probably still needed.
Specifically, comments every other line quickly add up and take up valuable space. Some, like the one above `sumOfSquares` are, in my opinion, unnecessary. It's obvious from the variable name and that `for` loop what's going on there.
My experience is that the best way to make equations legible is to use their matrix form - matrices are easy to explain to anyone who can add and multiply.
I'm currently in a project that's built around a few calculations and we settled on matrices because it's a language that every team member, from the project owners to developers, understands.