A sequence is simply an ordered list of objects. We will consider countably infinite lists of numbers. Such a sequence may be considered as a function with domain the set of positive integers and codomain the real numbers.
$f:\mathbb{Z}^+\to\mathbb{R}$
The elements (or terms) of a sequence are usually denoted using subscripts rather than function notation: $a_n=f(n)$.
The sequence is then denoted $\{a_n\}$, or more explicitly $\displaystyle\{a_n\}_{n=1}^{\infty}$. The integer $n$ is called the index of $a_n$.
Consider the sequence $12,\ 14,\ 16,\ 18,\ \ldots$
This may be written in various ways:
$a_n=10+2n$ for $n\ge 1$
$\{10+2n\}$
$\{10+2n\}_{n=1}^{\infty}$.
Of course, there is really no reason to start with $n=1$ all the time.
$a_n=2n$ for $n\ge 6$
$\{2n\}_{n=6}^{\infty}$
These give the same sequence.
Infinite sequences may be defined in various ways.
A list of numbers with some discernible pattern.
An explicit forumla for the $n^{th}$ term.
A recursive formula that gives one term in terms of one or more previous terms.
List of numbers:
$2,\ 3,\ 5,\ 7,\ 11,\ 13,\ \ldots$ (prime numbers)
Explicit formula:
$a_n=3n-5$ (unless otherwise stated, we'll assume $n$ starts at 1)
Recursive definition:
$a_n=a_{n-1}+a_{n-2}$ for $n\ge3$, $a_1=1$, $a_2=1$ (Fibonacci Sequence)
To graph a sequence, you put the index variable on the x-axis and the sequence values on the y-axis.
One way to graph a sequence in Sage is to use the "point" command with an imbedded for-loop.
Graph the first 50 terms of $a_n=3n-5$.
(Be very careful with the brackets and parentheses.)
Graph the first 50 terms of the sequence $\displaystyle a_n=\left(1+\frac{1}{n}\right)^n$.
Graph the first 10 terms of the Fibonacci Sequence: $a_n=a_{n-1}+a_{n-2}$ for $n\ge 3$, $a_1=1$, $a_2=1$.
There are different ways you might deal with this recursive definition in Sage. I will use a list. One issue is that a list in Sage always begins with index 0, while our sequence begins at 1. I'm going to get around this by sticking an extra 0 in the zero position.
Writing a=[0,1,1] makes a list of three numbers.
The first item in the list has index 0. You can access this by typing a[0]. Similarly, a[2] is the element in the list with index 2 (the third element in the list).
Graph the first 20 terms of the sequence $\displaystyle a_n=\frac{a_{n-1}}{2}+\frac{2}{a_{n-1}}$ for $n\ge2$, $a_1=15$.
If the sequence approaches some fixed number as $n\to\infty$, then we call this the limit of the sequence. We write $\displaystyle L=\lim_{n\to\infty}a_n$.
Here is the formal definition:
If for every $\epsilon>0$ there exists $N>0$ such that $|a_n-L|<\epsilon$ whenever $n>N$, then $\displaystyle L=\lim_{n\to\infty}a_n$.
In other words, you can get the terms of the sequence arbitrarily close to $L$ by making $n$ big enough.
Let's explore the definition of a limit graphically, using $\displaystyle\lim_{n\to\infty}\left(1+\frac{1}{n}\right)^n=e\approx 2.71828$.
In the interactive box below, $L$ represents the potential limit, and $\epsilon$ is the $\epsilon$ from the definition. If $L$ really is the limit, then eventually the sequence will stay in the band between $L-\epsilon$ and $L+\epsilon$.
Is the sequence eventually inside the red band?
Now make epsilon smaller (you may need to increase the starting and ending indices).
If we have an explicit formula, we can often compute the limit using Sage.
The limit command treats the sequence as a function on the real numbers, rather than just on the whole numbers. That means the limit command can give us the wrong answer.
Consider $\displaystyle\lim_{n\to\infty}\sin(\pi n)$
Here Sage gives the answer "ind," which means "indefinite but bounded." If we look at a graph of the function $\sin(\pi x)$, we can see why the limit does not exist: the function oscillates between $1$ and $-1$ forever.
However, the limit of the sequence does exist. When $n$ is a whole number, $\sin(\pi n)=0$ for all $n$, so the limit of the sequence is $0$.
If we have a recursive definition, then our best bet is to look at the graph to see if it looks like the limit exists. Then calculate many, many values of the sequence and see where we end up.
If $\{a_n\}$ is the Fibonacci Sequence, then consider the sequence $\displaystyle b_n=\frac{a_{n+1}}{a_n}$.
First, let's look at a graph.
It looks like the sequence is approaching a limit, somewhere around 1.6.
Let's compute values of the sequence and approximate what the limit is.
Try increasing "terms" and see what happens.
The actual limit of this sequence is the "Golden Ratio," denoted by the Greek letter $\phi$. The actual value is $\displaystyle \phi=\frac{1+\sqrt{5}}{2}$.
Estimate the limit of the sequence $a_n=\sqrt{a_{n-1}}$ for $n\ge 2$, $a_1=5$.
Solution: First, we'll graph the first 20 terms to see if the limit exists.
It looks like the limit exists. Graphically, we estimate that the limit is 1.
Let's confirm this numerically by calculating 50 terms.
It looks like the limit is indeed 1.