# Can sage help determine if $|f(x) - L| < \epsilon$ is true?

Here's what I want to check:

Given $f(x)$, $\epsilon>0$, $L\in \mathbb{R}$ and $N(\epsilon)$, is $$n>N(\epsilon) \Rightarrow |f(n)-L | < \epsilon$$ true?

I thought I could accomplish this using symbolic expressions and assume(). This is what I've tried:

forget()
var('ep, n')
f(x)=1/(n+7)
N = (1/ep)-7

assume(ep>0)
assume(n>N)

show(abs(f(n)-0)<ep)
bool(abs(f(n)-0)<ep)


But the result of is False. What is the proper way to do this in Sage?

edit retag close merge delete

Edited: "< epsilon" instead of "< 3" in the displayed equation. Also, you want f(x) = 1 / (x + 7), not 1 / (n +7).

Sort by » oldest newest most voted

Sage has some weaknesses when it comes to dealing with assumptions.

The best I can think of is the following:

sage: var('n eps')
sage: f(n) = 1 /(n + 7)
sage: assume('eps > 0')
sage: N = (1 / eps) - 7
sage: assume(n > N)
sage: sol = solve([abs(f(n)) < eps],n)
sage: sol
[[n < -7, -eps*n - 7*eps - 1 > 0],
[n == -7, -1 > 0],
[-7 < n, eps*n + 7*eps - 1 > 0]]


From there you can continue manipulating each of the "solutions".

Let's look at the second one. It's a bit disappointing that solve did not suppress it, given that -1 > 0 has no solution. But if you solve it again, you get an empty list, indicating "no solution" (beware that it might also mean "no solution found").

sage: a, b, c = sol
sage: b
[n == -7, -1 > 0]
sage: solve(b,n)
[]


For a, it's also disappointing that it doesn't get suppressed, since it's easy to derive that n > -7.

For c, it's also disappointing that it doesn't get simplified, since the second condition follows from the first, and could therefore be suppressed.

more