Shared03 - Limits Assignment / Limits Notes.sagewsOpen in CoCalc
This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is

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

plot(sin(x)/x)


From the graph, it appears that as , . Let's zoom in to confirm:

plot(sin(x)/x,xmin=-.25,xmax=.25)


One more time:

plot(sin(x)/x,xmin=-.1,xmax=.1)


Of course, a graph is no proof, but this is evidence that .

## Example 2

Find by zooming in on a graph.

%var t
plot((sqrt(t^2+9)-3)/t^2)


It looks like the limit is just above .

Let's zoom in:

plot((sqrt(t^2+9)-3)/t^2,xmin=-.1,xmax=.1)

plot((sqrt(t^2+9)-3)/t^2,xmin=-.01,xmax=.01)


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.

f(x)=(sqrt(x)-2)/(x-4)
plot(f,xmin=3,xmax=5)


Let's zoom in.

plot(f,xmin=3.9,xmax=4.1)


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.

f(x)=sin(x)/x
f(.1)
f(.01)
f(.001)
f(.0001)
f(.00001)
f(.000001)
f(.0000001)

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.

f(-.1)
f(-.01)
f(-.001)
f(-.0001)
f(-.00001)
f(-.000001)
f(-.0000001)

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

## Example 5

Estimate .

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

f(x)=(x^2-16)/(x-4)
f(4.1)
f(4.01)
f(4.001)
f(4.0001)
f(4.00001)
f(4.000001)
f(4.0000001)

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.

f(3.9)
f(3.99)
f(3.999)
f(3.9999)
f(3.99999)
f(3.999999)
f(3.9999999)

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 .

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

f(x)=(x^9+1)/(x+1)
f(-.9)
f(-.99)
f(-.999)
f(-.9999)
f(-.99999)
f(-.999999)
f(-.9999999)

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

f(x)=(x^9+1)/(x+1)
f(-1.1)
f(-1.01)
f(-1.001)
f(-1.0001)
f(-1.00001)
f(-1.000001)
f(-1.0000001)

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

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

limit(sin(x)/x,x=0)

1

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

f(x)=sin(x)/x
limit(f(x),x=0)

1

## Example 8

Now let's try .

limit((x^9+1)/(x+1),x=-1)

9

We can also compute limits at (end behavior).

## Example 9

Find .

limit(sqrt(x^2+x)-sqrt(x^2+1),x=+Infinity)

1/2

Here's a graph that confirms .

plot(sqrt(x^2+x)-sqrt(x^2+1),xmin=0,xmax=100)+plot(.5,xmin=0,xmax=100,color='red',linestyle='dotted',ymin=-.2,ymax=.6)


## Example 10

Find .

limit(sin(x)/x,x=-Infinity)

0
plot(sin(x)/x,xmin=-50,xmax=0)


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:

limit(1/x,x=0)

Infinity
plot(1/x,xmin=-5,xmax=5,ymin=-25, ymax=25)


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.

limit(1/x,x=0,dir='+')

+Infinity
limit(1/x,x=0,dir='-')

-Infinity

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

f=piecewise([[(-5,2),x^2],[(2,3),-2*x+5],[(3,5),x^3/10]])
plot(f,xmin=-5,xmax=5)


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 .

limit(-2*x+5,x=2,dir='+')
limit(x^2,x=2,dir='-')

1 4

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

%var h
f(x)=x^2
limit((f(x+h)-f(x))/h,h=0)

2*x

## Putting It All Together

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

## Example 14

Find .

plot(sin(1/x))


Let's zoom in.

plot(sin(1/x),xmin=-.1,xmax=.1)


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.

f(x)=sin(1/x)
f(0.1)
f(0.01)
f(0.001)
f(0.0001)
f(0.00001)
f(0.000001)
f(0.0000001)

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

f(-0.1)
f(-0.01)
f(-0.001)
f(-0.0001)
f(-0.00001)
f(-0.000001)
f(-0.0000001)

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.

limit(sin(1/x),x=0,dir='+')
limit(sin(1/x),x=0,dir='-')
limit(sin(1/x),x=0)

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 .

## Limits that do not exist

There are several different outputs in Sage that are possible when a limit does not exist.

1. und = "undefined" (this happens when the left and right limits exist but do not agree)

2. ind = "indefinite but bounded" (this happens when you have oscillation, like in the example above)

3. Infinity = "complex infinity" (the left limit is and the right limit is , or vice versa)

4. +Infinity = (the function increases without bound)

5. -Infinity = (the function decreases without bound)

Here are examples of each:

limit(x/abs(x),x=0)

und
limit(sin(1/x),x=0)

ind
limit(1/x,x=0)

Infinity
limit(1/x^2,x=0)

+Infinity
limit(-1/x^2,x=0)

-Infinity