SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons
      1. 2.1.1 Limits: what a function approachesConcept · 25 min
      2. 2.1.2 One-sided limits and continuityConcept · 30 min
      3. 2.1.3 Limits at infinityConcept · 30 min
      4. 2.1.4 Practice set: limitsPractice set · 25 min
      5. 2.1.5 Case study: continuous compounding as a limitCase study · 30 min

Level 2, Single-variable calculus 2.1 Limits and continuity Lesson 4 of 5

Practice setLesson 2.1.4 in Level 2, Single-variable calculus. About 25 minutes.

Practice set: limits

Limits

Limits (lesson 2.1.1)

0 of 6 correct

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 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, e is Euler's number, sqrt(x) is a square root.
  • sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for 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. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 6.
  7. 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, e is Euler's number, sqrt(x) is a square root.
  • sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for 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. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 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, e is Euler's number, sqrt(x) is a square root.
  • sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for 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

Exercise

Does the limit exist?

Write one_sided(f, a, side, h=1e-6) and limit_exists(f, a, tol=1e-4).

  1. one_sided returns f(a - h) when side is "left" and f(a + h) when it is "right": an estimate of each one-sided limit.
  2. limit_exists returns True when the two one-sided estimates are within tol of each other, and False otherwise.

Never call f(a) itself: at a hole it is undefined. The tests use x2−1x−1\frac{x^2 - 1}{x - 1} and sin⁡xx\frac{\sin x}{x}, whose limits exist, and x3x^3 at 2, where the function is continuous. They also use the jump ∣x∣x\frac{|x|}{x}, the piecewise jump from lesson 2.1.2, and the blow-up 1x\frac{1}{x}, which have no limit.

A numerical test can only suggest a limit (lesson 2.1.1). Yours will be fooled by 1x2\frac{1}{x^2} at 0: both sides give 101210^{12}, 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"

Free further reading

Optional. This lesson covers what you need; these add more examples and practice. All are free to read.

  • Calculus I, Limits

    Paul's Online Notes. Notes.

    Limits, derivatives and integrals in short sections with worked examples and practice.