# feb15 - MIT OpenCourseWare http/ocw.mit.edu 6.055J 2.038J...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MIT OpenCourseWare http://ocw.mit.edu 6.055J / 2.038J The Art of Approximation in Science and Engineering Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms . 2 Assorted subproblems 15 errors in the individual pieces are unlikely to point in the same direction. Some pieces will be underestimates, some will be overestimates, and the product of all the pieces is likely to be close to the true value. This numerical example is our first experience with the random walk. Their crucial feature is that the expected wanderings are significantly smaller than if one walks in a straight line without switching back and forth. How much smaller is a question that we will answer in Chapter 8 when we introduce special-cases reasoning. 2.6 The Unix philosophy Organizing complexity by breaking it into manageable parts is not limited to numerical estimation; it is a general design principle. It pervades the Unix and its offspring operating systems such as GNU/Linux and FreeBSD. This section discusses a few examples. 2.6.1 Building blocks and pipelines Here are a few of Unix’s building-blocks programs: head : prints the first n lines from the input; for example, head-15 prints the first 15 • lines. tail : prints the last n lines from the input; for example, tail-15 prints the last 15 • lines. How can you use these building blocks to print the 23rd line of a file? Divide and conquer! One solution is to break the problem into two parts: printing the first 23 lines and, from those lines, printing the last line. The first subproblem is solved with head-23 . The second subproblem is solved with tail-1 . To combine solutions, Unix provides the pipe operator. Denoted by the vertical bar | , it connects the output of one program to the input of another command. In the numerical estimation problems, we combined the solutions to the subproblems by using multiplica-...
View Full Document

## This note was uploaded on 02/24/2012 for the course MECHANICAL 6.055J taught by Professor Sanjoymahajan during the Spring '08 term at MIT.

### Page1 / 5

feb15 - MIT OpenCourseWare http/ocw.mit.edu 6.055J 2.038J...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online