Laboratory Assignment 2: Limits
Hopefully through the work done in class and from the book you understand that the basic idea of the limit limx® af(x) is to find the value that f(x) "gets close to" as x "gets close to" a. Hopefully we also understand that it is not important what happens to f exactly at a, i.e. the value of the limit in no way depends on what f(a) is defined to be or even if it is defined at all. And, hopefully, you have some idea that the formal definition of the limit tries to describe exactly how we make the expressions "gets close to" mathematically correct.
In this laboratory assignment we hope to reinforce some of these ideas you have about limits. We begin by showing you how you can use Matlab to help you make a table of values of f(x) when x is close to a. To do this we have chosen to construct the table by using an array, i.e. a matrix. We see that we begin by defining two symbolic variables x and A, the function f and fill the matrix A with zeros. We fill the matrix with zeros so that we begin with an initialized matrix of the correct size. We next start afor-end loop that we will use to fill our matrix A. We fill the first row, (1,k), k=1,…,8, with the values of x that we want to consider. We note that using the function 2-.1k to define x (A(1,k)) is just one approach of defining values near x=2. The command subs(f,x,A(1,k)) should be read "substitute in f for x the value A(1,k)." This is a very cumbersome way of evaluating f(A(1,k)) but it seems necessary. The end command ends the loop and the vpa(A,10) command prints out decimal values of the symbolic variable A with 10 places of accuracy. (The vpa stands for variable precision arithmetic.)
syms x A;
When we run the above code in Matlab we see that as x gets close to 2 from the left, f(x)=x3 gets close to 8. To predict the value of limx® 2x3 we would make an analogous table approach 2 from the right (using a code similar to that above---you should do that as a part of your lab report. To see that we are predicting the correct value, we could use the Matlab command
to compute the limit limx® 2x3, but we hope and assume that you know very well that limx® 2x3=8. And finally, we can write
syms a b
to see that f(2) is defined and equals 8 (but I hope that we were very aware that f was continuous at x=2).
You should now construct tables that predict limx® 2(x2-4)/(x-2). After you have the tables that predict the value of this limit (which you should already know), use thelimit command to compute that limit. Then evaluate the function g(x)= (x2-4)/(x-2) at x=2. Do you think Matlab is smart or dumb for the result that it gives for g(2)? And finally, use Matlab to make a table that will predict the value of the limit limx® 1+1/(x-1)3. Also try the limit command to evaluate this limit.
The next topic that we study is the rigorous definition of a limit. In the text we were given the definition that limx® af(x)=L if for every e >0 there exists a d such that whenever 0<| x-a| <d , | f(x)-L|<e . The secret to working with this definition is the understand that we have two steps: (1) give a rule to determine d and (2) show that the d works, i.e. show that whenever 0<| x-a| <d , | f(x)-L|<e .
In this part of the lab, we will choose particular e 's and find the d associated with the given e . We will then discuss how we know that this d works.
We begin by considering the limit limx® 2x3=8. As we stated earlier, to prove that this limit is correct we would have to give a rule that chooses d for any given e and show that this d works. We won't do that. What we will do is for one given value of e , e =1, we will find the d that works. In the figure below, we plot the function f(x)=x3, draw the lines y=8+e =9 (where we use an e in the figure for e because the text on the figures does not seem to allow for symbols) and y=8-e =7, and dropped vertical lines to the x axis from where the horizontal lines y=8± e intersect the curve. (We use the line tool on the tool bar in the figure window to draw the lines.) We label the points where the vertical lines intersect the x axis, 2± d . Really these points should be labeled 2+d 1 and 2-d 2 because the varying steepness of the curve makes the two points different distances from the point x=2. It should be very clear that any point between 2-d 2 and 2+d 1 will map to a point between 8-e and 8+e . Thus if we choose d to be the minimum of d 1 and d 2, then any point between 2-d and 2+d will map to a point between 8-e and 8+e (because any point between 2-d and 2+d is also between 2-d 2 and 2+d 1. Hence if x satisfies ê x-2ê <d , then ê x3-8ê<e .
The problem we are left with is to determine d . To find d 1 we must find the value such that f(2+d 1)=8+e , or in our case with e =1, we must find d 1 such that f(2+d 1)=9. With as easy a function we have this can be done analytically. Since we want to learn what Matlab can do for us (and we want to know how to do the next problem), we will use Matlab to solve this problem. If we use thehelp command on solve, we find that we can solve x3-9=0 by writing
It is probably better to write
so that when you get three solutions and we want only one of them, we can then refer to the solution that we want as w(1) (or w(2) or w(3)). Then since 2+d 1=w(1) or d 1=w(1)-2, if we write
we find that d 1=0.08008…. We repeat the process to find d 2 by solving x3=7, setting 2-d 2=w(1) and find that d 2=2-w(1)=0.08706….Hence, we choose d =0.08 (which is smaller than either d 1 or d 2, so it is ok). As we said before, the picture makes it obvious that this d works.
We should note that the use of Matlab for this problem was not really necessary. I think you'll appreciate having Matlab more for the next two problems. Also, Matlab seems to require that some of the operations be done in a way that is more complicated than should be necessary. We could have solved the above equations by defining x to be a symbolic variable and writing
However, it would not let you write solve(x^3=9).
Below we provide two plots, one of f(x)=2x3-3x2-12x and one of g(x)=(x+1)/2+log(ç 2x-3ç )/4. We are interested in the limits limx® -1(2x3-3x2-12x) and limx® 1[(x+1)/2+log(ç 2x-3ç )/4. The plot of f includes the lines 7± 0.1 and the plot of g includes the lines 1± 0.1. In both cases you should find the d associated with e =0.1 and use plots to show that the resulting d works. For example, one approach (once the function f has been defined) is to plot f on the interval [-1-d , -1+d ] and observe the the entire plot lies within the range of 7-e to 7+e .. Note that the absolute value in Matlab is the functionabs().