Ask Your Question
1

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

asked 2014-12-11 14:48:54 +0200

ensaba gravatar image

updated 2014-12-13 09:48:28 +0200

slelievre gravatar image

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 flag offensive close merge delete

Comments

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

slelievre gravatar imageslelievre ( 2014-12-13 09:49:59 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-12-13 10:25:42 +0200

slelievre gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-12-11 14:48:54 +0200

Seen: 516 times

Last updated: Dec 13 '14