Limits
Limits (lesson 2.1.1)
0 of 6 correct
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
How to type answers
- Powers with
^:x^7,2^(1/3),a^-2. - Multiply with
*or by writing side by side:3x^2,2(x+1). ln(x)is the natural log,log(x, 2)is log base 2,eis Euler's number,sqrt(x)is a square root.sin(x),cos(x)andtan(x)take radians; writepifor π andsin(x)^2for sin²x.- Your first answer to each question is saved: it counts towards your score and brings the question back for review.
- Exact answers like
ln(20)/ln(3)are best. Decimals need about 4 significant figures.
One-sided limits and continuity
One-sided limits and continuity (lesson 2.1.2)
0 of 7 correct
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
How to type answers
- Powers with
^:x^7,2^(1/3),a^-2. - Multiply with
*or by writing side by side:3x^2,2(x+1). ln(x)is the natural log,log(x, 2)is log base 2,eis Euler's number,sqrt(x)is a square root.sin(x),cos(x)andtan(x)take radians; writepifor π andsin(x)^2for sin²x.- Your first answer to each question is saved: it counts towards your score and brings the question back for review.
- Exact answers like
ln(20)/ln(3)are best. Decimals need about 4 significant figures.
Limits at infinity
Limits at infinity (lesson 2.1.3)
0 of 6 correct
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
How to type answers
- Powers with
^:x^7,2^(1/3),a^-2. - Multiply with
*or by writing side by side:3x^2,2(x+1). ln(x)is the natural log,log(x, 2)is log base 2,eis Euler's number,sqrt(x)is a square root.sin(x),cos(x)andtan(x)take radians; writepifor π andsin(x)^2for sin²x.- Your first answer to each question is saved: it counts towards your score and brings the question back for review.
- Exact answers like
ln(20)/ln(3)are best. Decimals need about 4 significant figures.
Coding exercise
Does the limit exist?
Write one_sided(f, a, side, h=1e-6) and limit_exists(f, a, tol=1e-4).
one_sidedreturnsf(a - h)whensideis"left"andf(a + h)when it is"right": an estimate of each one-sided limit.limit_existsreturnsTruewhen the two one-sided estimates are withintolof each other, andFalseotherwise.
Never call f(a) itself: at a hole it is undefined. The tests use and , whose limits exist, and at 2, where the function is continuous. They also use the jump , the piecewise jump from lesson 2.1.2, and the blow-up , which have no limit.
A numerical test can only suggest a limit (lesson 2.1.1). Yours will be fooled by at 0: both sides give , so it says True, though both sides blow up.
See the tests
import math
def _hole(x):
return (x**2 - 1) / (x - 1)
def _jump(x):
return abs(x) / x
def _pieces(x):
return x**2 if x < 2 else x - 1
def test_left_and_right_estimates():
"""Both sides of (x² − 1)/(x − 1) at 1 are close to 2"""
expect_close(one_sided(_hole, 1, "left"), 2.0, what="left estimate", rel=1e-5)
expect_close(one_sided(_hole, 1, "right"), 2.0, what="right estimate", rel=1e-5)
def test_jump_sides():
"""|x|/x is −1 just left of 0 and 1 just right of it"""
expect_close(one_sided(_jump, 0, "left"), -1.0, what="left of 0")
expect_close(one_sided(_jump, 0, "right"), 1.0, what="right of 0")
def test_hole_limit_exists():
"""The limit of (x² − 1)/(x − 1) at 1 exists"""
assert limit_exists(_hole, 1) is True, "expected True for (x² − 1)/(x − 1) at 1"
def test_sin_limit_exists():
"""The limit of sin(x)/x at 0 exists"""
assert limit_exists(lambda x: math.sin(x) / x, 0) is True, "expected True for sin(x)/x at 0"
def test_continuous_limit_exists():
"""The limit of x³ at 2 exists"""
assert limit_exists(lambda x: x**3, 2) is True, "expected True for x³ at 2"
def test_jump_limit_does_not_exist():
"""The limit of |x|/x at 0 does not exist"""
assert limit_exists(_jump, 0) is False, "expected False for |x|/x at 0"
def test_piecewise_jump():
"""x² for x < 2 and x − 1 for x ≥ 2 has no limit at 2 (the sides head for 4 and 1)"""
expect_close(one_sided(_pieces, 2, "left"), 4.0, what="left of 2", rel=1e-5)
expect_close(one_sided(_pieces, 2, "right"), 1.0, what="right of 2", rel=1e-5)
assert limit_exists(_pieces, 2) is False, "expected False for the piecewise jump at 2"
def test_blow_up_does_not_exist():
"""1/x has no limit at 0 (it heads for −∞ on the left and ∞ on the right)"""
assert limit_exists(lambda x: 1 / x, 0) is False, "expected False for 1/x at 0"