Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
License: OTHER
Image: ubuntu2004

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Prerequisites:
Intro to Sage
Graphing and Solving Equations
Limits
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.
Example 1
Consider the function . Notice that is not defined, but we may be able to find , so let's look at a graph.
From the graph, it appears that as , . Let's zoom in to confirm:
One more time:
Of course, a graph is no proof, but this is evidence that .
Example 2
Find by zooming in on a graph.
It looks like the limit is just above .
Let's zoom in:
It looks like 0.1667 is our best estimate for the limit.
Example 3
Find
We want to see what happens around , so we need to change the window.
Let's zoom in.
It looks like the limit is 0.25.
Finding Limits Numerically
Now let's consider limits numerically. We want to see what happens to when we make close to something. Since it may make a difference whether we approach from the left or right, we should estimate both.
Example 4
Estimate .
To do this we'll need to estimate and .
First, we'll do the right limit. So I am going to calculate for values of close to , but greater than . I'll use , , , etc. for my inputs.
Notice that the outputs get closer and closer to 1, so it looks like
Now let's do the left limit. I need values of close to but less than , so I'll use , , , etc.
Once again the outputs get closer and closer to 1, so it looks like .
So I conclude the two-side limit is also : .
[Note: This is not a proof that the limit is 1, it is simply numerical evidence.]
Example 5
Estimate .
First let's estimate the limit from the right. I need inputs close to but bigger than . I'll use , , , etc.
The outputs get closer and closer to , so it looks like the right limit is .
Now let's look at the limit from the left. Now I need numbers less than , so I'll use , , , etc.
Once again, the outputs get closer and closer to , so it looks like the left limit is also . So I conclude .
Example 6
Estimate .
Once again, we'll look at the limit from the left and right.
First, approximate .
I want values slightly bigger than that approach . I'll use , , , etc. [Note that these values are bigger than .]
The outputs get closer and closer to , so it looks like the right limit is .
Now approximate . I need inputs close to and less than . I'll use , , , etc. [Note that these values are less than .]
Once again, the outputs get closer and closer to , so it looks like the left limit is also .
Therefore, I conclude that (you could confirm this using algebra).
Computing Limits Using Sage
You can use the limit command to compute limits in Sage: limit(f(x),x=a)
Example 7
First, let's try .
You can also use a function name in the limit command.
Example 8
Now let's try .
We can also compute limits at (end behavior).
Example 9
Find .
Here's a graph that confirms .
Example 10
Find .
We have to be careful when we do two-sided limits, because Sage may lead us astray.
Example 11
Consider . 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.
One-Sided Limits
To do one-sided limits in Sage, simply add dir='+' or dir='-' to the limit command.
Example 12
Here is an example of a piecewise function:
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 does not exist. We may want to find and , 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, and .
Limits Involving More Than One Variable
Sage can also evaluate limits involving more than one variable. Don't forget to declare all variables other than .
Example 13
Suppose . Evaluate .
Putting It All Together
Here is an example that uses the graphical, numerical, and computational approaches to evaluate a limit.
Example 14
Find .
Let's zoom in.
From the graph, we can see that there is a lot of oscillation near . Let's see what happens numerically.
We'll start with input values that approach 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 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 approaches , approaches . As the magnitude of the input gets larger, the sine function continues to oscillate between and .
Limits that do not exist
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 and the right limit is , or vice versa)
+Infinity = (the function increases without bound)
-Infinity = (the function decreases without bound)
Here are examples of each: