正在加载图片...
6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 6.5.5 And once I have the idea of integration, I again can treat this asIntegration as a procedure an abstraction. For example, I can use the fact that inverse Integration under a curve f is given roughly by rigonometric functions are described as integrals, and thus by dx(a)+fa+ dx)+(a+ 2dx)+.+(b) building on the idea of integration, I can easily compute the inverse tangent function et((delta(/(b a) n))) integral (lambda (x)(1(+ 1(square x))))0 a))) ntegration as a procedure Slide 6.5.6 The point is that by capturing common patterns of computation, dx(f(a)+f(a+dx)+f(a+2dx)+.+f(b) whose parameters may themselves be patterns of computation, we can quickly abstract out complex operations without getting lost in the details C (sum f a delta n) delta) (define atan (lambda (a) Slide 6.5.7 Finding fixed points of functions Notice how we have generalized things. We have moved functions that mapped numbers to numbers, to more general nethods that work independent of the function. F Think of as a transformation: y--then if we can find a ntegral is a procedure that takes any function as input, instead y=vx, then f()=y, and such a y is called a fixed point off. of just a number, and produces a number as output Let's turn to other ways of capturing common patterns in higher order procedures. Let's go back to square root, but think about it a different way. One way to think about the process of square root is to note that the square root of x is defined as the value that is equal to x divided by the same value If we think of the transformation that maps values of y into the ratio of x over y, then we can see that if we can somehow find a value for y that is the actual square root of x, then the value of f applied to that y will be equal to its input. Such a point is called a fixed point, a point at which the transformation f has the same input and output value This suggests another way of finding square roots, namely to see if find a guess for the input to f that happens to be a fixed point of f, for this particular f, or in other words, see if we can find fixed points of a function6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 6.5.5 And once I have the idea of integration, I again can treat this as an abstraction. For example, I can use the fact that inverse trigonometric functions are described as integrals, and thus by building on the idea of integration, I can easily compute the inverse tangent function. Slide 6.5.6 The point is that by capturing common patterns of computation, whose parameters may themselves be patterns of computation, we can quickly abstract out complex operations without getting lost in the details. Slide 6.5.7 Notice how we have generalized things. We have moved functions that mapped numbers to numbers, to more general methods that work independent of the function. For example, integral is a procedure that takes any function as input, instead of just a number, and produces a number as output. Let's turn to other ways of capturing common patterns in higher order procedures. Let's go back to square root, but think about it a different way. One way to think about the process of square root is to note that the square root of x is defined as the value that is equal to x divided by the same value. If we think of the transformation that maps values of y into the ratio of x over y, then we can see that if we can somehow find a value for y that is the actual square root of x, then the value of f applied to that y will be equal to its input. Such a point is called a fixed point, a point at which the transformation f has the same input and output value. This suggests another way of finding square roots, namely to see if we can find a guess for the input to f that happens to be a fixed point of f, for this particular f, or in other words, see if we can find fixed points of a function
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有