Created
November 23, 2016 15:15
-
-
Save aherve/3bd8652a79fafa33ef8f85e701b9421e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # derivative_scheme.(f).(x) shall be a function of epsilon | |
| derivative_sheme = -> f { | |
| -> x { | |
| -> eps { | |
| div.( minus.(plus_eps.(eps).(f), min_eps.(eps).(f) ), mult.(const.(2), const.(eps))).(x) | |
| } | |
| } | |
| } | |
| # And the derivative operator: | |
| # Let's fix the treshold at tres = 1e-16 | |
| derivate = -> f { | |
| -> x { | |
| lim.(derivative_sheme.(f).(x),1,1e-16).(0) # limit of the derivative scheme of f(x), taken at epsilon = 0 | |
| } | |
| } | |
| # Isn't that fancy ? We juste define the derivative operator | |
| # exactly as being the limit of (f(x + e) - f(x - e))/(2e) when epsilon -> 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment