The Maple code below finds a $N$ such that $|x_n-l|<\varepsilon \: \: \forall n \geq N$ for a given $\varepsilon$ for the sequence $\mathbb{N}\to\mathbb{R}$ defined by $$n \mapsto \frac{n^2}{n^2+30n+189},$$ where $l$ is the limit of the sequence.
I am having trouble determining what is wrong with the code. The code works in general, but I want to list the last few data points, this is why I have set $m:=N-5$. But the code still prints all of the data points.
ev := proc(epsilon)
global f, l, N, m;
f := n -> n^2/(n^2+30*n+189);
l := limit(f(n), n = infinity);
print(l);
for N while epsilon < abs(f(N)-l) do
N := N+1
end do;
print(N);
m := N-5;
for m to N do
A := [m, f(m)];
print(A)
end do;
end proc
Some help would be great!
Try the following:
After m:=N-5 in the for loop use for k from m to n do A:=[k,f(k)]; print(A) end do;
As it is, your $m$ is temporarily used as an unassigned variable used only in the for loop, and the previous assignment of it is ignored, so that for m to N is interpreted as the default for m from 1 to N etc.