This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

- Intro to Sage
- Graphing and Solving Equations

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 . 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 .

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.

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.

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.

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.

0.998334166468282
0.999983333416666
0.999999833333342
0.999999998333333
0.999999999983333
0.999999999999833
0.999999999999998

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.

0.998334166468282
0.999983333416666
0.999999833333342
0.999999998333333
0.999999999983333
0.999999999999833
0.999999999999998

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.]

Estimate .

First let's estimate the limit from the right. I need inputs close to but bigger than . I'll use , , , etc.

8.10000000000002
8.00999999999998
8.00100000000103
8.00010000000828
8.00000999982319
8.00000099831254
8.00000010658141

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.

7.90000000000000
7.99000000000002
7.99900000000075
7.99989999999173
7.99998999999917
7.99999899991110
7.99999989341859

Once again, the outputs get closer and closer to , so it looks like the left limit is also . So I conclude .

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 .]

6.12579511000000
8.64827525163591
8.96408387412594
8.99640083987451
8.99964000839680
8.99996400013025
8.99999639954673

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 .]

13.5794769100000
9.36852726843608
9.03608412612599
9.00360084012607
9.00036000840086
9.00003600009180
9.00000359934304

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).

You can use the limit command to compute limits in Sage: limit(f(x),x=a)

First, let's try .

1

You can also use a function name in the limit command.

1

Now let's try .

9

We can also compute limits at (end behavior).

Find .

1/2

Here's a graph that confirms .

Find .

0

We have to be careful when we do two-sided limits, because Sage may lead us astray.

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:

Infinity

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.

+Infinity

-Infinity

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 .

1
4

Sage can also evaluate limits involving more than one variable. Don't forget to declare all variables other than .

Suppose . Evaluate .

2*x

Here is an example that uses the graphical, numerical, and computational approaches to evaluate a limit.

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.

-0.544021110889370
-0.506365641109759
0.826879540532003
-0.305614388888252
0.0357487979865591
-0.349993502171293
0.420547793190783

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.

0.544021110889370
0.506365641109759
-0.826879540532003
0.305614388888252
-0.0357487979865591
0.349993502171293
-0.420547793190783

Once again, it does not appear that the outputs are approaching anything.

Let's see what Sage tells us.

ind
ind
ind

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 .

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:

und

ind

Infinity

+Infinity

-Infinity