1 | initial version |
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.