NUMERICAL METHODS AP Calculus AB Summer Review 2013 ANALYTICAL METHODS For as long as you have taken math, you have learned analytical methods to solving problems These methods involve a well-defined procedure and provide an exact answer AP Calculus AB, SJHS 2013-2014 even if it’s in terms of a complex or irrational number Unfortunately, very few “real world” problems are analytical Most real world problems involve data sets, and you must infer information from these sets 2 NUMERICAL METHODS Still, you must use caution not to take numerical solutions as absolute answers AP Calculus AB, SJHS 2013-2014 Numerical methods are ways of solving math problems based on data sets, and they do not necessarily require an analytical method or solution Numerical methods do have an analytical theory behind them, usually involving statistics These are useful since there are no constraints they are often approximations The answers are found by trial and error methods, which a computer algebra system (or “CAS”) can do very quickly So the computer actually checks which answers work The one that works best is “printed” as the answer 3 SYSTEMS OF NONLINEAR EQUATIONS We remember working with systems of linear equations AP Calculus AB, SJHS 2013-2014 These are functions of variables to the first power No other powers or special functions were allowed You may remember that one method of solving was to draw a graph and find the intersection of the lines By extension, we can find the intersection(s) of nonlinear functions to find the solution(s) of systems of nonlinear equations This is numerical since the solution is usually at a value we can’t analytically calculate 4 x ye EX: y x 5 AP Calculus AB, SJHS 2013-2014 First, we should notice that since they both equal y, we can set the functions equal to each other (Method of Substitution) x e x 5 The problem is that to solve it, we would need to take a logarithm to undo the exponential, but we just trade one problem for another Which is worse? e x x 5 x ln x 5 Instead, let’s just look at our original problem, and instead view them as two different functions: y1 e x y2 x 5 5 EXAMPLE CONTINUED Y1 e ^ X Your calculator uses this form! Type this into your calculator and take a look at the graph You can also type this into GraphCalc; this program literally took me 1min to install and it was ready for use http://www.graphcalc.com/, click “Download” at the top left menu in blue, click the first link under Regular Users (GraphCalc.exe), click the green button that says Download Now! (don’t bother with the ad behind it If you’re a Mac, you can try Graphing Calculator 3D for Mac AP Calculus AB, SJHS 2013-2014 Y2 X 5 http://download.cnet.com/Graphing-Calculator-3D/30002053_4-10896524.html#rateit Now we’re ready for some numerical methods 6 EXAMPLE CONTINUED You should see this graph As you can see, the intersections occur somewhere around x=-2 and x=5 How to solve it on your calculator After you typed in the functions, go to CALC (the 2nd of TRACE) Click Intersect It will take you back to the graph; move the cursor near the intersection point (doesn’t have to be exact) & click It now needs you to confirm this on the other graph, so move to that same intersection point & click It will now ask for a guess; depending on which intersection, you can give it a guess; otherwise just press enter There’s your first answer; do this for all other intersection points AP Calculus AB, SJHS 2013-2014 How to solve it in Graph Calc Go to Tools > Equation Solver and click Type in e^(-x)=-x+5 Give it your guess; let’s say, -2 It gives the answer that is closest to your guess; if you said 7, it would’ve given you the other intersection point 7 ZEROS A zero is where a function crosses the x-axis For linear functions, just set y = 0 We learned a general analytical solution, the Quadratic Formula, that solves the zeros of quadratic functions Occasionally you can easily solve zeros of exponentials, logs, and trig equations What if we have other equations that need zeros? AP Calculus AB, SJHS 2013-2014 This is usually a nonlinear function with a mix of incompatible function types We can solve these using numerical methods 8 EX: x sin x 0 2 This does not have an analytical solution, and according to the graph there exist two real roots We could do a trial and error using the Location Principal AP Calculus AB, SJHS 2013-2014 zeros occur between any positive/negative transition Luckily, modern computers can quickly do this trial and error 9 EX: x 2 sin x 0 CONTINUED To solve using the calculator To solve in Graph Calc Go to Tools > Equation Solver and click Type in x^2+sin(x) … if you don’t give another side of the equation, it will assume you want a zero Give it your guess It gives the answer that is closest to your guess AP Calculus AB, SJHS 2013-2014 type in the function go to CALC (2nd of TRACE), click Zero Your calculator doesn’t know which zero to find (there could be several), so you need indicate where it is; it asks for a “left bound” then a “right bound” When it says “Left Bound”, bring the cursor to a point that is left of the zero (doesn’t have to be too close) When it says “Right Bound”, bring the cursor to a point that is right of the zero (doesn’t have to be too close) It will ask for a guess; you can provide one, or just press Enter If you get an error message, you might have placed your bounds around two zeros, so make sure your bounds only surround one answer 10 LINEAR REGRESSIONS Among the most useful numerical tools is a linear regression Linear data is the most useful, and if you go into applied science and math you will see that analysis is often done by “linearizing” The “goodness of fit” is represented by the correlation value, or r2 parameter AP Calculus AB, SJHS 2013-2014 Values near 1 are a good fit If r2 = 1, then it is a perfect fit (not likely) Let’s look at a simple example 11 EXAMPLE 1 Make a linear regression of the data set, with a proper equation. 2 Is this a good fit? 3 What is the high school-to-college GPA factor? What does this mean? 4 Predict the GPA of a student 1.6 GPA in high school. College 1.6 2 1.8 3.3 2.8 2.1 2 2.65 2.25 2.6 3 3.1 3.2 AP Calculus AB, SJHS 2013-2014 A group of students are surveyed during their freshman year of college. They are anonymously asked their GPA during high school and their first year of college. The results are summarized on the table (no names). HS 2 2.25 2.6 2.9 2.65 2.8 3.1 2.9 3.25 3.3 3.6 3.25 4 12 EXAMPLE CONTINUED We can plot this data set in our calculator, or on a computer we can use Microsoft Excel Excel: Type in one set in a column, then the other set in another column To see the data, click Insert and choose Scatter (just the dots) The Excel table was shown last slide Calculator: go to STAT > Edit… and several lists will appear Fill in those lists with data To display, go to STAT PLOT (2nd of “Y=”) and turn stat plot on Go to ZOOM, then ZoomStat (it’s there, you just need to find it on the list) AP Calculus AB, SJHS 2013-2014 13 EXAMPLE CONTINUED To make a linear regression Don’t forget to click “Display equation” and “Display r2” at the bottom. If you forget, just click on the line and go to format trendline Calculator: STAT > CALC > LinReg(ax+b) The equation will display To pull up the r2, go to VARS > Statistics > EQ > r2 AP Calculus AB, SJHS 2013-2014 Excel: right click on any data point on the graph (they’ll all light up) and go to “Add Trendline”, and choose Linear 14 EXAMPLE GRAPH THEN LINEAR REGRESSION 4 3 2.5 2 1.5 1 0.5 0 0 0.5 1 1.5 2 2.5 3 3.5 4 High School GPA 4 College GPA 3.5 3 2.5 AP Calculus AB, SJHS 2013-2014 College GPA 3.5 2 1.5 y = 0.7187x + 0.3583 R² = 0.4625 1 15 0.5 0 0 0.5 1 1.5 2 2.5 High School GPA 3 3.5 4 EXAMPLE CONTINUED 1 Linear regression with equation & r2 2 This is an okay fit; r2 in 80 or 90 percent range is very good, but we got about 46% (a little low) 3 The coefficient is .71; this means your GPA is expected to be only about 71% of what it was before. However, the data goes through a lot of points! You’ll notice this is on average, but several students in this data set have basically the same, if not higher, GPAs. It’s a statistical quantity. 4 To answer our last question, we might jump to say: AP Calculus AB, SJHS 2013-2014 1.6 .71 1.14 However, this point is outside of our data set domain We cannot predict anything lower than 2.00 or higher than 4.00 since that is the extent of our domain 16 OTHER REGRESSIONS Excel has the capability to give regressions for polynomials (up to x6), exponential, logarithmic, and power laws Calculators like a TI-84 or other graphing calculator can give polynomial (up to x4), exponential, logarithmic (natural and common), power law, and sine regressions To graph these, go to Y=, then press VARS > Statistics > EQ > ReEq AP Calculus AB, SJHS 2013-2014 This menu also stores all constants from your regression 17 WHAT KIND OF REGRESSION IS THIS? y 0 2 3 6 7 8 1 10 12 8 7 8 Given any data, you cannot assume it is a linear set. First graph the points, then try to eyeball what it looks like. In this case, it is difficult to tell. AP Calculus AB, SJHS 2013-2014 x Graph 15 10 5 0 0 5 10 18 BUT IT DOESN’T LOOK LINEAR! Linear Regression Graph 14 12 12 y = 0.3581x + 6.1149 R² = 0.0912 10 10 8 8 6 6 4 4 2 2 0 0 2 4 6 8 10 0 0 2 4 6 8 10 AP Calculus AB, SJHS 2013-2014 14 The r2 is too low, and it clearly doesn’t go through many points. We’ll try another one. 19 THE QUADRATIC IS BETTER Graph Quadratic Regression 14 12 12 10 10 8 8 6 6 4 4 y = -0.4609x2 + 4.1328x + 2.2031 R² = 0.7273 2 2 0 0 0 2 4 6 8 10 0 2 4 6 You can see that the quadratic is a better fit. The r2 is much better. 8 10 AP Calculus AB, SJHS 2013-2014 14 But still not very good... 20 TRY A CUBIC REGRESSION Cubic Regression Graph 14 14 12 12 10 10 8 8 y = 0.1249x3 - 1.9052x2 + 8.1158x + 0.9076 R² = 0.9912 4 4 2 2 0 0 0 2 4 6 8 10 0 2 4 6 This r2 is nearly perfect! Looks like a good fit. Problem: the equation is very complicated. 8 10 AP Calculus AB, SJHS 2013-2014 6 6 In this case, it’s better to have a very good answer even if it takes a little more copying. 21 NO NEED TO GO TOO FAR Quartic Regression Graph 14 14 12 12 10 8 8 6 6 4 4 2 2 0 y = 0.0174x4 - 0.1646x3 - 0.4275x2 + 5.9245x + 0.9893 R² = 0.999 0 0 2 4 6 8 10 0 2 4 6 8 We can take it a step further and get a slightly better r2, but ask yourself, is the more complex formula that much better? Let’s stick with the cubic in this case 10 AP Calculus AB, SJHS 2013-2014 10 22 SEQUENCES AND SERIES A sequence is a set of numbers that follow a pattern Typically, a problem begins with finding the pattern and expressing it numerically Sequences use a notation similar to function notation The variable is placed as a subscript to the sequence name AP Calculus AB, SJHS 2013-2014 A series is the summation of some or all numbers of a sequence 23 EXAMPLE OF A SEQUENCE The average temperatures for each month in a city in Arizona are: Some samples from this series are: January m=1 T1 = 66 July m=7 T7 = 84 November m =11 T11 = 71 AP Calculus AB, SJHS 2013-2014 Tm 66,71,75,76,76,80,84,83,83,77,71,68 24 EXAMPLE OF A SERIES A small business has the following revenues. Rn 11320,10240,15770,7880,9990,12540,6500,19430,13010,8850,10060,11210 We model the year profits as a series, which means we add up all revenue numbers (from the first to the twelfth months), taking only one tenth of each 12 1 Rn n 1 10 P We say: “P equals the sum from n equals 1 to 12 of one-tenth R-n” AP Calculus AB, SJHS 2013-2014 90% of that money goes towards expenses, so the business profits one-tenth of the revenues. How much does the business profit in one year? P 1132 1024 1577 788 999 1254 650 1943 1301 885 1006 1121 P 13680 25 FINDING PATTERNS OF SEQUENCES Arithmetic: There is a common difference between each number Geometric: There is a common ratio between each number. Exponential: term. The numbers relate to an exponent of the sequence Alternating: Numbers alternate positive and negative. Even: component. All numbers are even, or have a strictly even Odd: All numbers are odd, or have a strictly odd component. Recursive: Each term is dependent on the value of one or more AP Calculus AB, SJHS 2013-2014 At first, you should verbalize the pattern, then figure out a way to express it mathematically Always mentally check the first few terms by substituting in n = 1, 2, etc to see if they match up with your sequence Some common patterns: 26 ARITHMETIC SEQUENCE EXAMPLES For each sequence, determine the common difference d, then write an expression for the sequence. Assume each sequence starts at n=0. a) an 7,15,23,31, b) an 77,54,31,8, d 23 an 77 23n Notice that you can plug in n = 0, 1, 2, 3,... And the result is the given sequence AP Calculus AB, SJHS 2013-2014 d 8 an 7 8n Pattern: each number is 8 more than the previous! That’s the common difference, and each term adds 8. 27 GEOMETRIC SEQUENCES Find the common ratio r to each geometric sequence. Then write an expression for the sequence. Assume each sequence begins at n = 0. a) an 81,54,36,24, r 2 3 b) an 64, 32,16, 8,... 1 r 2 n 1 an 64 2 c) AP Calculus AB, SJHS 2013-2014 n 2 an 81 3 Pattern: each number is 2/3 of the previous! That’s the common ratio, and each term is multiplied by 2/3. This is expressed as an exponent. an 8,20,50,125, 5 r 2 n 5 an 8 2 28 CONSTRUCTING SEQUENCES Alternating: factor of (-1)n - as n goes from even to odd, so will your sequence Odd numbers: use (2n+1) - This is always odd Recursive: include an-1, an-2, etc - These indicate “the term before n”, “two terms before n”, etc AP Calculus AB, SJHS 2013-2014 Even numbers: use 2n - This is always even 29 DESCRIBE EACH SEQUENCE, AND EXPRESS EACH IN SEQUENCE NOTATION. 1 1 1 a) *the denominators are all perfect odd an 1, , , , 9 25 49 squares 1 an 2 2n 1 an 3,7,19,39, an 2n 3 *each term is an even square, plus three 2 c) an 0, 7,14, 21,28, an 1 7n n d) an 0,1,4,9,16, an n 2 an an1 2n 1 e) 3 1 1 , ,0, , 2 2 2 n an cos 6 an 1, *these are the factors of seven, alternating positive and negative *this is clearly the sequence of squares *we can also look at it as recursive, with each term being the previous plus the odd numbers in sequence - Start at zero, add 1, add 3, add 5, add 7... *these are exact values of cosine, on intervals of pi/6 AP Calculus AB, SJHS 2013-2014 b) 30 NUMERICAL METHODS ASSIGNMENT This quiz opens July 29 and closes Aug 12 This is the last quiz and assignment, so please enjoy the last part of your summer before we begin the class AP Calculus AB, SJHS 2013-2014 31 END AP Calculus AB, SJHS 2013-2014 32 toothpastefordinner.com