Design Modeling, Estimation and Analysis1 aka “Street-Fighting Mathematics” Design decisions often require calculations with incomplete information. Time and resources are always limited as well, and so an efficient engineer needs to be able to make approximations easily and quickly, and not be too reliant on calculators or computers. These skills are particularly important in technical leadership, as they allow you to check the work of your team without redoing their calculations. The text that this lecture refers to, by Sanjoy Mahajan, calls these techniques “streetfighting mathematics” because they are quick & dirty—effective but not elegant. Street-Fighting Math Technique #1: Dimensional Analysis Consider the following quote2: In Nigeria, a relatively economically strong country, the GDP [gross domestic product] is $99 billion. The net worth of Exxon is $119 billion. “When multinationals have a net worth higher than the GDP of the country in which they operate, what kind of power relationship are we talking about?” asks Laura Morosini. Q: What is wrong with the comparison between Exxon and Nigeria? Q: What is the difference between dimensions and units? It’s also important to use consistent units. The crash of the 1999 Mars Climate Orbiter was due to inconsistency in units among the designers of the many pieces of the system1. Dimensional analysis can even help you to solve problems without more formal techniques like integration. Example: A ball initially at rest falls from a height h and hits the ground at speed v. Find v assuming a gravitational acceleration g and neglecting air resistance Here’s how you could quickly approximate the solution using dimensional analysis. First, you should observe the following: 1 This lecture relies heavily on the following book: Sanjoy Mahajan, “Street-Fighting Mathematics: The Art of Educated Guessing and Opportunistic Problem Solving,” MIT Press, Creative Commons Attribution–Noncommercial–Share Alike 3.0, 2010. 2 Anne Marchand. Impunity for multinationals. ATTAC, 11 September 2002, quoted by Mahajan. So now you’re looking at combinations of h & g that follow these rules, aided by your intuition that the higher you start or the greater the acceleration rate, then the faster you expect the ball to hit the ground. You’d probably start by observing: Therefore, to get the units of v, you need to take the square root of h*g. The use of the tilde acknowledges the fact that there could be a dimensionless constant involved in the solution (as in fact there is). Now let’s compare that to the more rigorous approach using calculus: Given: (1) d2y/dt2 = -g (2) y’(0) = 0 (3) y(0) = h Dimensional analysis got us to an approximation that preserved all of the functional dependency with much less work! Sure, it’s off by a constant—but for many questions this would be insignificant. Note also that there are many opportunities for error in the calculus-based derivation. The conclusion: Dimensional analysis is a great way to come up with a quick approximation. At the very least, you should use it to check your work! For this particular example, I have to point out that energy methods (a street-fighting physics technique) are also very effective: Using dimensions to guess integrals: Consider the Gaussian integral: ∞ 2 ∫ 𝑒 −∝𝑥 𝑑𝑥 −∞ This is a good example of a “hard” integral to solve, particularly if you don’t happen to have access to integral tables. Dimensional analysis to the rescue! Start by observing the following—since this is a definite integral evaluated over x, then the result must not be a function of x. However, it could be a function of . So you could write this as: ∞ 2 ∫ 𝑒 −∝𝑥 𝑑𝑥 = 𝑓(∝) −∞ Next, go ahead and assign a dimension to x--- the choice doesn’t matter! In this case, let’s use length (L) for x. We now can figure out the dimension of , because we know that the quantity in the exponent of e must be dimensionless: So, now we can find the dimensions of the left side of the integral, using the fact that the dimensions of dx will also be length: Since the dimensions of a are L-2, and we need to get to dimensions of L, then our best guess for the result of this integral is: Which is not bad, given that the actual expression for the Gaussian integral is: Street-Fighting Math Technique #2: Easy Case Analysis The solution to a mathematical problem must work in all cases—including the easy ones! A good example of how you might have used this in the past is for RC circuit analysis. You probably remember than an RC circuit has an exponential response with the time constant, RC (please tell me you remember that!). But perhaps you are a little fuzzy on the details. Can you use your fuzzy memory to solve for vc(t) in the following circuit3, without re-deriving the response? t=0 Since you remember that it was exponential, you might initially come up with a handful of candidate solutions (note that you can use dimensional analysis combined with your knowledge that D{RC} = time, to know that the exponent for e should have the form of t/RC): a) b) c) d) vo(t) = K*e-t/RC vo(t) = K*et/RC vo(t) = K*(1-e-t/RC) vo(t) = K*(1-et/RC) What next? Test each option with the easy cases: Only answer (c) works for both easy cases! Furthermore, by substituting the expression of (c) into the infinite boundary, you can figure out that K = Vs. The answer: vc(t) = Vs(1-e-t/RC) Another example, used in Mahajan’s text, is finding the equation for the area of an ellipse characterized by the parameters a & b as follows: We can find the answer with a combination of dimensional analysis and easy cases. For example, we know the following: 3 Circuit image copied from: http://people.sinclair.edu/nickreeder/eet155/mod02.htm The units of the area should be length^2, where a and b have units of length The area should increase if either a or b increases a&b should be interchangeable since that would just mean rotating the shape 90 degrees—i.e. you should be able to swap a & b in the equation and get the same result (this would eliminate an answer like 3a2 + b2, for example) This suggests two likely forms for the solution to consider: Now, let’s apply the easy cases: Street-Fighting Math Technique #3: Lumping Let’s say you’re considering the potential market for your product, which is targeted to men and women between the ages of 18 and 22 in the United States. To calculate this exactly, you’d need to know the latest census data, which might provide the following information for the distribution of people by age in the United States (what do the units 10 6/yr mean?) You would then need to integrate under this curve for the ages of 18 to 22. This could be a lot of work depending on the availability of the census numbers, and census figures can be flawed or out of date. On the other hand, you don’t really need a precise number anyway. This is perfect for a lumped approach. A lumped approach here might be to approximate the N(t) quantity as a constant, using the fact that the U.S. population (in 2008) was 300 million, and the average life-span is ~80 years. Therefore, the average population/year group, is about: Therefore, your market size = Why did we go from 80 to 75 years? Because it made the math much easier by cleanly dividing into 300 and it’s just an approximation anyway, so we’re not worried about incurring an error by changing from 80 to 75 years! Street-Fighting Math Technique #4: Isolate the powers of ten Consider the following expression for the storage (in bits, N) of a CD: To quickly estimate this quantity without a calculator, separate out the powers of 10: Note that I went ahead and multiplied 2 by 16—that’s because it’s an easy calculation to do in your head—anything easy like that should be done up front. The remaining portion is not easy to multiply in one’s head however—so now you round each term to “one”, “few” or “ten”. “Few” lies between 1 & 10 and so can be approximated as the geometric mean of 1 & 10 which is about 3. So I would round anything less than 2 down to 1, anything greater than 6 up to 10 and use “few” for everything in between. Remember—it’s just an approximation! In this case, all three of the terms fall into the category of “few”. So the approximation becomes: The actual answer is 5x109—a little less than twice the estimated answer, but definitely the same order of magnitude, and much easier to calculate. You can refine this method further by rounding to nearest integer value rather than to 1-few-ten, so for this example: And that is a pretty good estimate. Street-Fighting Math Technique #5: Successive approximation In this technique you start with a coarse estimate, and then refine the estimate given your answer. The example problem from Mahajan is the stone in the well: You drop a stone down a well of unknown depth h and hear the splash 4 s later. Neglecting air resistance, find h to within 5%. Use cs = 340 m/s as the speed of sound and g = 10m/s2 as the strength of gravity. To solve this exactly, you could start with the equation for the total time, T, which would have two parts: the time for the rock to fall down and the time for the sound to come back up: To solve for h exactly, you would massage this into a quadratic equation and then solve via the quadratic formula. But that process could take a lot of algebra, particularly if you don’t have a fancy calculator handy. However, you suspect that the speed of sound is pretty fast compared to the speed of the falling rock, so you can instead get a quick estimate of the answer by assuming that all of the time is spent by the rock falling--- this would yield: You could then use this answer to approximate the time for sound travel: If you didn’t need much accuracy in your answer, you could stop here, as 0.24 s is a small fraction of 4s, validating your assumption about sound traveling much faster than the rock, but if needed you can improve the accuracy with another round of estimation by using this to better estimate the fall time: And then better estimate the well depth: Now you have a new estimate for the sound travel time and for the rock falling time: And you could continue until you had the desired level of accuracy. What advantages does this have over just using the quadratic formula? For one thing, this technique helps you to build intuition about the problem. Also, there are many problems that don’t have a closed form solution, whereas this sort of iterative solution can always work. It’s another good tool for the toolbelt. Applying this to your Capstone So you might be wondering—what does this have to do with capstone? The challenge of capstone is that you are not working a closed-form problem with a “cookie cutter” answer. You will be working with a lot of incomplete information and unknowns. Estimation plays a much greater role than it does in “normal” coursework. Here are some pointers: Know your numbers. Every project has some characteristic numbers that you should familiarize yourself with. Some examples: o Expected power levels o Expected signal levels o Data size o Distance and length scales For every calculation, think about what you expect the answer to be. After you make the calculation, ask yourself if the result is reasonable. Track “intermediate” values in calculations. For example, if you need to solve the power dissipated by a particular component in a circuit, don’t start with a mass of algebra that spits out the power as one equation with lots of parts. Instead, solve for all the voltages or currents in the circuit and record those values before going on to solve for the power of interest. Those intermediate values may be useful for other calculations, and the practice also helps you to build intuition about your system. Estimate early. For example, if you’re considering a solar panel for powering your circuit, go ahead and estimate what size of panel would be needed, even though you may not yet know your exact power draw. The numbers often dictate whether or not a solution is reasonable for your problem. You don’t want to find out in March that the solar panel you ordered for Capstone isn’t up to the job. Estimation is a great team activity-- have the team brainstorm together ways to come up with reasonable estimates for the quantities in your project.