Scheme Derivative Function

对着背影说爱祢 提交于 2019-12-02 04:26:14

Yes, the code in the question is returning a function (that's what the lambda is for). If it were returning a value, it'd be missing the line with (lambda (x) and the corresponding closing parentheses.

Also notice that although the procedure is correct, the formula stated in the question isn't right, it should be:

g(x) = (f(x+h) - f(x))/h ; notice that x is the parameter to the second call to f

As a side note, the correct way to use the derivative function as defined would be:

(define der-sqr (der square 1e-10)) ; create the derivative *function*
(der-sqr 10)                        ; apply the function
=> 20.000072709080996
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!