/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ /* [ Created with wxMaxima version 11.08.0 ] */ /* [wxMaxima: title start ] Going to Infinity: What Happens to Functions When the Independent Variable Gets Bigger and Bigger and Bigger? [wxMaxima: title end ] */ /* [wxMaxima: comment start ] Chapter 2 Technology Application Project [wxMaxima: comment end ] */ /* [wxMaxima: section start ] Introduction [wxMaxima: section end ] */ /* [wxMaxima: comment start ] OBJECTIVE: To interpret limits going to infinity graphically and numerically. In this module, you will explore limits of functions as the independent variable approaches infinity, and you will formulate and test some end-behavior models. We will examine graphs and create tables of function values for large values of the independent variable. The focus here is on comparing the behavior of some important functions that you will encounter throughout your study of calculus. [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] Technology Guidelines [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] NOTE: If you have just finished a document, restart Maxima before executing a new document. This can be done by choosing "Restart" from the Maxima menu. TO OPEN OR CLOSE CELLS Click on the arrow at the top of the cell bracket. TO STOP AN EXECUTION Click on STOP button from the toolbar. ORDER OF EXECUTION Execute commands in the order given. Do not skip any Maxima Input lines within a given document. Alternatively, you can execute the entire worksheet by selecting the "Evaluate All Cells" command from the "Cell" drop down menu or simply press Ctrl-r. SAVING WORKSHEETS You can save anytime to any directory you choose, and it is wise to save often. EXPERIENCING MAJOR PROBLEMS Save if appropriate, and then shut down Maxima and start it up again. [wxMaxima: comment end ] */ /* [wxMaxima: section start ] PART I: Exploring End Behavior [wxMaxima: section end ] */ /* [wxMaxima: comment start ] Consider the following four examples. Can you determine why the end behavior is so different in each case? Example 1: x/(sqrt(10+x^2)) [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ load(draw)$ numer:true$ ratprint: false$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ g1 (x) := x/sqrt(10+x^2)$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, explicit(g1(x), x, -10, 10), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] It looks as though the function is approaching 1 as x gets large. Let's evaluate the function at 1 million. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ g1(1000000); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Example 2: x/(sqrt(10+x^23)) Now we will increase the power of x in the denominator. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ g2 (x) := x/sqrt(10+x^3)$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, explicit(g2(x), x, -2, 20), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] What do you think happens as x gets bigger and bigger? Let's plot the function out further and also evaluate it at a large value of x, say 1 billion. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, explicit(g2(x), x, -2, 2000), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ g2(10^9); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Example 3: x/sqrt(10+x) Now we decrease the power of x in the denominator. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ g3 (x) :=x/sqrt(10+x)$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, explicit(g3(x), x, -9, 20), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] What do you suppose is happening as x gets large beyond bound? Let's extend the graph. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, explicit(g3(x), x, -9, 1000), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] It looks as though it is getting bigger, but not terriby fast. Let's evaluate the function at 1 trillion. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ g3(10^12); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Example 4: log(x)/sqrt(10+x^2) Here is a function involving the natural log of x. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ h2 (x) := log(x)/sqrt(10+x)$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, explicit(h2(x), x, 0.2, 20), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] What do you think happens to the value of h(x) as x gets bigger and bigger? Do we need to extend the plot? [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, explicit(h2(x), x, 0.2, 200), xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Now it has turned downward and seems to be approaching 0, but very slowly. Is that what you guessed before? Let's evaluate the function at x = 1 trillion to see if the downward trend continues. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ h2(10^12); /* [wxMaxima: input end ] */ /* [wxMaxima: subsect start ] You Try It: Part I [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] Limits Involving log(x)/sqrt(10+x^n) In the fourth example in Part I, we used 2 for the power of x in the denominator of the function log(x)/sqrt(10+x^n). In this example, we want you to consider other powers of x, therefore, we leave the power variable and call it n. Explore what happens as you change the value of n, and see if you can find a value for n that will give a finite nonzero value for the limit as x approaches infinity. We help you get started by looking at n = 0.1. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ h1 (x) := log(x)/sqrt(10+x^0.1)$ bigx: 10^12$ wxdraw2d( nticks=200, color=red, explicit(h1(x), x, 1, bigx), xlabel="x", ylabel="y"); h1(bigx); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Do you think this function approaches a finite limit other than 0 as x approaches infinity? Check it out for a very large value of x (say, 10^50, for example) by changing the value of bigx in the cell above and re-executing it. If it doesn't work, try some other values for n, and see if you can find one that does work. [wxMaxima: comment end ] */ /* [wxMaxima: section start ] PART II: End Behavior Models [wxMaxima: section end ] */ /* [wxMaxima: comment start ] An end behavior model for a function f(x) is a function g(x) such that lim(x->0) f(x)/g(x) = 1. Can we find an end behavior model for f(x) = x/sqrt(10+x^2), the first example function in Part I? To do this you should consider what happens to the denominator when x is a very large number. In this case, 10+x^2 = x^2, since 10 is almost insignificant in comparison to when x is large, and sqrt(10+x^2) = sqrt(x^2) = x. Therefore, we guess that g(x) = x/x = 1 is an end behavior model for f(x). Let's test it out, first by taking the limit of as x approaches infinity, and then by plotting f(x) and g(x) on the same graph. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ f (x) := x/sqrt(10+x^2)$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ g (x) := 1$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ limit(f(x)/g(x), x, inf); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=green, explicit(f(x), x, -50, 50), color=red, explicit(g(x), x, -50, 50), yrange=[-1.5,1.5], xlabel="x", ylabel="y"); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Because the value of the limit is 1, g(x) is an end-behavior model for f(x). The graph shows that as x gets large, f(x) and g(x) get closer together, as we would expect. [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] You Try It: Part II [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] How Do Functions End? 1. Use the approach outlined in Part II to find end behavior models for the two functions in Examples 2 and 3 in Part I. Test your model by evaluating lim(x->infinity) f(x)/g(x) and provide support for the result by plotting f(x) and g(x) on the same graph. 2. Based upon the results of your investigation of the function f(x) = log(x)/sqrt(10+x^2) in Part I, Example 3, do you think there is an end behavior model f(x) that is of the form g(x) = x^n, where n is a positive number less than 1? We said earlier that the log functions grow very slowly as x gets larger. Well, radical functions of the form just described also grow slowly. Which functions do you think grow more slowly log functions or those of the form x^n, where n is a rational number less than 1? [wxMaxima: comment end ] */ /* [wxMaxima: section start ] PART III: Rates of Growth of Polynomial Functions Versus Exponential Functions [wxMaxima: section end ] */ /* [wxMaxima: comment start ] Which type of function will grow faster as x gets large without bound, a polynomial function like x^100 or an exponential function like 2^x? Let's see what we can find out about this issue by graphing the ratio of the two functions. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ kill(all)$ reset()$ load(draw)$ numer:true$ ratprint: false$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ f (x) := x^100/2^x; wxdraw2d( nticks=200, color=red, explicit(f(x), x, .5, 100), xlabel="x", ylabel="y"); print("This function evaluated at x = 100 is" , f(100.0))$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] (Note: In case the numbers on the vertical axis are showing only the powers of 10, we have evaluated the function at 100 so you can see how large the function becomes.) This graph seems to suggest that the polynomial function grows more rapidly and outstrips the exponential function. To be sure that this pattern continues, let's plot the ratio of the two functions over a larger domain. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, explicit(f(x), x, 0, 300), xlabel="x", ylabel="y"); print("This function evaluated at x = 150 is" , f(150))$ print("This function evaluated at x = 300 is" , f(300))$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Look at this! For a while, the polynomial function out-runs the exponential function, but eventually it is overtaken by the exponential function. (Note: In case the numbers on the vertical axis are showing only the powers of 10, we have evaluated the function at two points so you can see how large the function becomes.) The value of the ratio at x = 300 is still large, however, so let's see what happens for values of x in the neighborhood of 1000. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ wxdraw2d( nticks=200, color=red, explicit(f(x), x, 1000,1010), xlabel="x", ylabel="y"); print("This function evaluated at x = 1010 is" , f(1010))$ /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] It appears that 2^x is now growing faster than x^100. Therefore, the ratio of the latter over the former is going to 0, as x gets larger. Next, we create a table of very large values of x to see if the pattern persists. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ matrix1: matrix(["x", "f(x)"])$ for i: 10^6 thru 2*10^6 step 10^5 do matrix1: addrow(matrix1,[i,f(i)])$ matrix1; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You can see that the function values shown are so close to 0 that Maxima just calls them 0. In the long run, exponential functions of the form a^x where a is a positive constant greater than 1, will always outgrow a polynomial function of the form x^n, no matter how big n is and no matter how close a is to 1. The power function may win out at first, but in the end the exponential function always comes out on top. [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] You Try It: Part III [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] What does this have to do with NP-Complete problems? A very important concept in computer science is related to polynomial growth rate versus exponential growth rate. Look up the term NP-Complete, and write two paragraphs explaining what this is about and why it is important. [wxMaxima: comment end ] */ /* [wxMaxima: section start ] PART IV: Euler's Very Special Number [wxMaxima: section end ] */ /* [wxMaxima: comment start ] Here is a function that you may have seen before if you studied interest on an investment that compounds more and more frequently during a year. Let's suppose that you invest $100 in an account that pays interest at an annual percentage rate of 5% and you leave the earned interest in the account to compound. If the interest is compounded n times per year, the amount of principal in the account at the end of one year will be 100(1+0.05/n)^n. We graph the principal in the account after one year for n = 1, 2, . . . , 12, and generate a table of values. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ f (n) := 100*(1+0.05/n)^n$ accumulation: makelist([i,f(i)], i, 1, 12)$ wxdraw2d( nticks=200, color=red, explicit(f(n),n,1,12), color=blue, point_size=1, point_type=6, points(accumulation), xlabel="n", ylabel="accumulation"); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ print("Here are some examples of the amount in the account (in dollars)")$ print("at the end of one year if the interest is compounded once, twice, ...,")$ print("up to 12 times a year (monthly)")$ matrix1: matrix(["interest pd / yr", "account balance"])$ for i: 1 thru length(accumulation) step 1 do matrix1: addrow(matrix1, accumulation[i])$ matrix1; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] What do you think happens to the function below, as n gets larger and larger, in other words, as you approach a situation where the interest compounds continuously at every instant in time during the year? To find out, let's evaluate the limit of the principal function as n goes to infinity. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ numer:true$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ limit(f(n),n,inf); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Because we set numer to true, Maxima evaluates the function using floating-point arithmetic, giving a decimal approximation for the value of the function and the limit. If we set numer to false, Maxima will give us the exact value of the limit, provided it can evaluate the limit. Let's see what happens. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ numer:false$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ limit(f(n),n,inf); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Are you surprised? The base is Euler's number e. Why is this happening? [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] You Try It: Part IV [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] Limits Involving (1+r/n)^(n*t) 1. Evaluate the last limit in Part IV, but change the initial investment amount to P0, and change the annual percentage rate to r. Be sure that you kill the variable r before you evaluate the limit, otherwise, Maxima will use the last value that was assigned to r when it evaluates the limit. Now we will consider what would happen if we were to invest $100 for periods longer than one year. Our investment earns interest for t years, and we consider what happens over the years if interest on our investment is compounded quarterly, contrasting this to what happens when the interest is compounded continuously. We start with an annual percentage rate of 15% and see how the investment grows if left untouched over the years. The amount of principal in the account after t years is given by 100(1+r/n)^(n*t), where n is the number of times the interest is compounded each year, and t is the number of years the money is invested. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ r: 0.15$ f (t) := 100*(1+r/n)^(t*n)$ f(1); f(2); f(3); f(4); f(5); f(10); f(20); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ numer:true$ matrix2: matrix(["years", "quarterly compound", "continuous compounding"], [1, subst(4,n, f(1)), limit(f(1), n, inf)], [2, subst(4,n, f(2)), limit(f(2), n, inf)], [3, subst(4,n, f(3)), limit(f(3), n, inf)], [4, subst(4,n, f(4)), limit(f(4), n, inf)], [5, subst(4,n, f(5)), limit(f(5), n, inf)], [10, subst(4,n, f(10)), limit(f(10), n, inf)], [20, subst(4,n, f(11)), limit(f(11), n, inf)]); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] To see the effect of the interest rate on the investment, build a table that shows the amount invested after 5 years for annual percentage rates of 5%, 10%, 15%, 20%, 25%, and 30%. In each row of the table, show the annual percentage rate, the principal in the investment account after 5 years when the interest is compounded quarterly, when it is compounded continuously, and the difference in the amount of principal for the two compounding methods. Which factor has more effect on the earnings, the annual percentage rate paid on the investment or the frequency at which the interest is compounded? [wxMaxima: comment end ] */ /* Maxima can't load/batch files which end with a comment! */ "Created with wxMaxima"$