正在加载图片...
6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 8.3.5 First, I need to figure out exactly what I want in terms of the 1. How to get started behavior of my system. So let,'s look carefully at what the pieces.Analyze the problem precisely are. For primitive algebraic expressions, we know that there deriv constant dx= 0 are some simple rules. The derivative of a constant with deriv variable dx 1 if variable is the same as x respect to any variable is just zero. The derivative of a variable with respect to itself is just one, while the derivative of any deriv(e1+e2)dx deriv e1 dx+ deriv e2 dx other variable with respect to this variable is also zero. Note 1*(deriv e2 dx)+e2*(deriv e1 dx) that we are inherently assuming that a variable is not a function of some other variable For more complicated expressions, we have some very rules. For example to get the derivative of a sum with to some variable. we know that we can take the derivative of the two parts of the sum, then add those results back together to get the final expression. For the derivative of a product, a slightly more complicated rule states that we can take the derivatives of the pieces of the product multiply the results by appropriate other parts, then add the result together to get the final value. Note that this should look familiar. Notice what we are doing. We are taking a complex thing, reducing it to simpler versions of the same operation on smaller pieces, and then gluing the parts back together again. So to apply derivatives to omplex things, we do this recursively on simpler pieces Here then are some rules for the overall behavior I want my differentiation system to obey 1. How to get started Slide 8.3.6 Analyze the problem precisely We can observe several useful things about what we have done First, note that e l and e2 might themselves be complex =1 if variable is the same as x expressions, in which case we would apply these rules again to each of those pieces. Thus, our procedure will need to (er"e2)dx=e1"(deriv e2 dx)+e2.(deriv e1 dx) recursively walk down these expressions, applying these rules to subsequent pieces Second, as we noted, the derivative of a sum is decomposed "derivative of(e1+e2) formed from deriv e1 and deriv e2 into simpler versions of the same problem on smaller pieces, e1 and e2 might be complex subexpressions .a tree problem plus a simpler operation that puts the results back together I Putting these two observations together, we can see that expressions might not be lists, but lists of lists, sometimes called trees, of arbitrary depth. That is, we can apply these rules to expressions whose parts are themselves sums or products of elements who might be sums or products, and so on. We simply want to recursively apply the rules to break the problem down into simpler pieces until we ultimately reach primitive cases, then glue all the parts back together as6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 8.3.5 First, I need to figure out exactly what I want in terms of the behavior of my system. So let's look carefully at what the pieces are. For primitive algebraic expressions, we know that there are some simple rules. The derivative of a constant with respect to any variable is just zero. The derivative of a variable with respect to itself is just one, while the derivative of any other variable with respect to this variable is also zero. Note that we are inherently assuming that a variable is not a function of some other variable. For more complicated expressions, we have some very nice rules. For example, to get the derivative of a sum with respect to some variable, we know that we can take the derivative of the two parts of the sum, then add those results back together to get the final expression. For the derivative of a product, a slightly more complicated rule states that we can take the derivatives of the pieces of the product, multiply the results by appropriate other parts, then add the result together to get the final value. Note that this should look familiar. Notice what we are doing. We are taking a complex thing, reducing it to simpler versions of the same operation on smaller pieces, and then gluing the parts back together again. So to apply derivatives to complex things, we do this recursively on simpler pieces. Here then are some rules for the overall behavior I want my differentiation system to obey. Slide 8.3.6 We can observe several useful things about what we have done. First, note that e1 and e2 might themselves be complex expressions, in which case we would apply these rules again to each of those pieces. Thus, our procedure will need to recursively walk down these expressions, applying these rules to subsequent pieces. Second, as we noted, the derivative of a sum is decomposed into simpler versions of the same problem on smaller pieces, plus a simpler operation that puts the results back together. Putting these two observations together, we can see that expressions might not be lists, but lists of lists, sometimes called trees, of arbitrary depth. That is, we can apply these rules to expressions whose parts are themselves sums or products of elements who might be sums or products, and so on. We simply want to recursively apply the rules to break the problem down into simpler pieces until we ultimately reach primitive cases, then glue all the parts back together again
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有