Hacker News new | past | comments | ask | show | jobs | submit login

Are you familiar with automatic differentiation? https://blog.demofox.org/2014/12/30/dual-numbers-automatic-d... note that you get f(x) and f'(x) for some x without getting the derived function.



Ooh, that's a neat technique. I think you can get an expression for the derivative from it.

Say we want the derivative of f(x) = x^3 - 2x^2 + 5. That becomes:

(x+e)^3 - 2(x+e)^2 + 5

= x^3 + 3x^2e - 2x^2 -4xe + 5

= (x^3 - 2x^2 + 5) + (3x^2 - 4x)e

The term in front of 'e' is "3x^2 - 4x", which is f'(x).


Just to clarify: This result follows directly from the definition of the derivative:

f'(x) = lim_{e->0} (f(x+e) - f(x))/e

If you're able to express f(x+e) on the form (f(x) + y e) then it follows that y is the derivative.

It also should be noted that auto-diff doesn't let you skip the rules for derivation and you're using the same calculation as you would to show that e.g. f'(x^n)=n*x^{n-1}.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: