In this lab we will be exploring the concept of limits graphically, numerically, and computationally.
As you know from the lecture, a limit is the value approached by the outputs of a function as the inputs approach some given value.
Consider the function $\displaystyle f(x)=\frac{\sin(x)}{x}$. Notice that $f(0)$ is not defined, but we may be able to find $\displaystyle\lim_{x\to 0}f(x)$, so let's look at a graph.
From the graph, it appears that as $x\to 0$, $f(x)\to1$. Let's zoom in to confirm:
One more time:
Of course, a graph is no proof, but this is evidence that $\displaystyle\lim_{x\to0}f(x)=1$.
Find $\displaystyle\lim_{t\to 0}\frac{\sqrt{t^2+9}-3}{t^2}$ by zooming in on a graph.
It looks like the limit is just above $1.66\times 10^{-1}=0.166$.
Let's zoom in:
It looks like 0.1667 is our best estimate for the limit.
Find $\displaystyle\lim_{x \to 4}\frac{\sqrt{x}-2}{x-4}$
We want to see what happens around $x=4$, so we need to change the window.
Let's zoom in.
It looks like the limit is 0.25.
Now let's consider limits numerically. We want to see what happens to $f(x)$ when we make $x$ close to something. Since it may make a difference whether we approach from the left or right, we should estimate both.
Estimate $\displaystyle\lim_{x\to0}\frac{\sin(x)}{x}$.
To do this we'll need to estimate $\displaystyle\lim_{x\to0^+}\frac{\sin(x)}{x}$ and $\displaystyle\lim_{x\to0^-}\frac{\sin(x)}{x}$.
First, we'll do the right limit. So I am going to calculate $f(x)$ for values of $x$ close to $0$, but greater than $0$. I'll use $0.1$, $0.01$, $0.001$, etc. for my inputs.
Notice that the outputs get closer and closer to 1, so it looks like $\displaystyle\lim_{x\to0^+}\frac{\sin(x)}{x}=1$
Now let's do the left limit. I need values of $x$ close to $0$ but less than $0$, so I'll use $-0.1$, $-0.01$, $-0.001$, etc.
Once again the outputs get closer and closer to 1, so it looks like $\displaystyle\lim_{x\to0^-}\frac{\sin(x)}{x}=1$.
So I conclude the two-side limit is also $1$: $\quad\displaystyle\lim_{x\to0}\frac{\sin(x)}{x}=1$.
[Note: This is not a proof that the limit is 1, it is simply numerical evidence.]
Estimate $\displaystyle\lim_{x\to4}\frac{x^2-16}{x-4}$.
First let's estimate the limit from the right. I need inputs close to $4$ but bigger than $4$. I'll use $4.1$, $4.01$, $4.001$, etc.
The outputs get closer and closer to $8$, so it looks like the right limit is $8$.
Once again, the outputs get closer and closer to $8$, so it looks like the left limit is also $8$. So I conclude $\displaystyle\lim_{x\to4}\frac{x^2-16}{x-4}=8$.
Estimate $\displaystyle\lim_{x\to-1}\frac{x^9+1}{x+1}$.
Once again, we'll look at the limit from the left and right.
First, approximate $\displaystyle\lim_{x\to-1^+}\frac{x^9+1}{x+1}$.
I want values slightly bigger than $-1$ that approach $-1$. I'll use $-0.9$, $-0.99$, $-0.999$, etc. [Note that these values are bigger than $-1$.]
The outputs get closer and closer to $9$, so it looks like the right limit is $9$.
Now approximate $\displaystyle\lim_{x\to-1^-}\frac{x^9+1}{x+1}$. I need inputs close to $-1$ and less than $-1$. I'll use $-1.1$, $-1.01$, $-1.001$, etc. [Note that these values are less than $-1$.]
Once again, the outputs get closer and closer to $9$, so it looks like the left limit is also $9$.
You can use the limit command to compute limits in Sage: $\displaystyle\lim_{x\to a}f(x)=$ limit(f(x),x=a)
First, let's try $\displaystyle\lim_{x\to0}\frac{\sin(x)}{x}$.
You can also use a function name in the limit command.
Now let's try $\displaystyle\lim_{x\to -1}\frac{x^9+1}{x+1}$.
We can also compute limits at $\pm\infty$ (end behavior).
Find $\displaystyle\lim_{x\to\infty}\left(\sqrt{x^2+x}-\sqrt{x^2+1}\right)$.
Here's a graph that confirms $\displaystyle\lim_{x\to\infty}\left(\sqrt{x^2+x}-\sqrt{x^2+1}\right)=\frac{1}{2}$.
Find $\displaystyle\lim_{x\to-\infty}\frac{\sin(x)}{x}$.
We have to be careful when we do two-sided limits, because Sage may lead us astray.
Consider $\displaystyle\lim_{x\to0}\frac{1}{x}$. We know from the graph that the left and right limits are different (one is positive infinity and the other is negative infinity). But look at what Sage tells us:
In this context, 'Infinity' refers to complex infinity, in which case postive and negative are not distinguished.
It's a good idea to check your answers with a quick graph. Then you won't have to worry about this.
To do one-sided limits in Sage, simply add dir='+' or dir='-' to the limit command.
Here is an example of a piecewise function: $$f(x)=\begin{cases} x^2, & \text{if } -5\le x\le 2\\ -2x+5, & \text{if } 2
Sage is able to graph a piecewise function, although it inserts some extra horizontal line segments that shouldn't really be there.
We can see from the graph that $\displaystyle\lim_{x\to2}f(x)$ does not exist. We may want to find $\displaystyle\lim_{x\to2^+}f(x)$ and $\displaystyle\lim_{x\to2^-}f(x)$, but Sage's limit command is not yet able to handle piecewise functions. Instead, we'll have to figure out which formula to give the limit. In this case, $\displaystyle\lim_{x\to2^+}f(x)=\lim_{x\to2^+}(-2x+5)=1$ and $\displaystyle\lim_{x\to2^-}f(x)=\lim_{x\to2^-}x^2=4$.
Sage can also evaluate limits involving more than one variable. Don't forget to declare all variables other than $x$.
Suppose $f(x)=x^2$. Evaluate $\displaystyle\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$.
Here is an example that uses the graphical, numerical, and computational approaches to evaluate a limit.
Find $\displaystyle\lim_{x\to0}\sin\left(\frac{1}{x}\right)$.
Let's zoom in.
From the graph, we can see that there is a lot of oscillation near $0$. Let's see what happens numerically.
We'll start with input values that approach $0$ from the right.
These values do not appear to approach anything. Notice how they jump between positive and negative, and the magnitudes get bigger and smaller.
Now let's consider input values approaching $0$ from the left.
Once again, it does not appear that the outputs are approaching anything.
Let's see what Sage tells us.
Whether we try a one- or two-sided limit, Sage gives the same answer: "ind." This stands for "indefinite but bounded," but for us this means "does not exist."
This confirms what we saw on the graph and from the numbers. This should make sense algebraically as well. As $x$ approaches $0$, $\frac{1}{x}$ approaches $\pm \infty$. As the magnitude of the input gets larger, the sine function continues to oscillate between $1$ and $-1$.
There are several different outputs in Sage that are possible when a limit does not exist.
und = "undefined" (this happens when the left and right limits exist but do not agree)
ind = "indefinite but bounded" (this happens when you have oscillation, like in the example above)
Infinity = "complex infinity" (the left limit is $\infty$ and the right limit is $-\infty$, or vice versa)
+Infinity = $\infty$ (the function increases without bound)
-Infinity = $-\infty$ (the function decreases without bound)
Here are examples of each: