Experience-Monks / math-as-code

a cheat-sheet for mathematical notation in code form
MIT License
14.99k stars 1.07k forks source link

limit, derivatives #10

Open mattdesl opened 9 years ago

mattdesl commented 9 years ago

Branch: https://github.com/Jam3/math-as-code/tree/feature/derivatives-integrals

Let me know if there's problems. Some of these are pretty challenging to explain in code / developer terms. :confused:

Ideally I'd like to find a less "mathy" way of demonstrating this part, to make it a bit more code/newb-friendly. Basically the whole "derivatives" section could do with a clean up.

screen shot 2015-06-30 at 1 40 16 pm

mattdesl commented 9 years ago

Based on feedback; I think it might be good to split derivatives into two parts: theory (what it is now) + application (e.g. using Newton's method? Or something else entirely?). Right now, those already familiar with derivatives aren't getting much out of it.

winkerVSbecks commented 9 years ago

@mattdesl would it be a good idea to have 2 cases in the limit function (when represented in code):

function f (x) {
  return x === 1 ? 2 : (Math.pow(x, 2) - 1) / (x - 1);
}
wraybowling commented 8 years ago

Hi. I just want to chime in that I'm going to review this branch. I'm right on the cusp of understanding what a derivative is, and I have no idea how to calculate one with code. I feel that my feedback would somehow be helpful... I've been studying calculus on khan academy for weeks now trying my best.

wraybowling commented 8 years ago

I think it's doing an okay job of explaining the concepts up until the big honkin blob of math equations. It might also be nice if a solution was provided in code as to how one would write a function that finds a derivative.. or maybe a link to one if it's too verbose.

kevinbarabash commented 8 years ago

@wraybowling the big blob of algebra describes a relatively simple concept. The derivative is the slope of a function at a particular point. Calculating what that may be for any particular function is where the challenge comes in.

I'm not sure that math-as-code really makes sense for derivatives. If you want code to easily determine the derivatives of functions you might use dual numbers and something called automatic differentiation. Although this makes determining the derivative easy it relies on already knowing common derivatives which doesn't really help with understanding the concept. The limits used by math which can be used to compute a derivative don't really work well with code because code isn't a particular good too for algebraic manipulations.