SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons
      1. 1.4.1 Exponents and their rulesConcept · 25 min
      2. 1.4.2 Exponential functions and the number eConcept · 25 min
      3. 1.4.3 Logarithms and their rulesConcept · 25 min
      4. 1.4.4 Solving exponential and logarithmic equationsConcept · 25 min
      5. 1.4.5 Practice set: exponents and logarithmsPractice set · 25 min
      6. 1.4.6 Case study: compounding and continuous ratesCase study · 35 min
      7. 1.4.7 Case study: simple returns and log returnsCase study · 30 min

Level 1, Precalculus 1.4 Exponents and logarithms Lesson 5 of 7

Practice setLesson 1.4.5 in Level 1, Precalculus. About 25 minutes.

Practice set: exponents and logarithms

Exponent rules

Exponent rules (lesson 1.4.1)

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.

Exponential functions and e

Exponentials and e (lesson 1.4.2)

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.

Logarithms

Logarithms (lesson 1.4.3)

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.

Solving equations

Solving for x (lesson 1.4.4)

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.

Coding exercise

Exercise

Solve for an unknown exponent

Write solve_exponent(a, b, c) that returns the xx solving a⋅bx=ca \cdot b^x = c.

  • Isolate the power first, then use logs, as in lesson 1.4.4.
  • Raise ValueError when there is no solution: when b <= 0, when b == 1, when a == 0, or when c / a is not positive.

The tests check easy cases, a decay base below 1, a negative a with a negative c, and each kind of impossible equation.

See the tests
import math


def _raises_value_error(a, b, c):
    try:
        solve_exponent(a, b, c)
    except ValueError:
        return True
    return False


def test_simple_power():
    """2^x = 8 gives x = 3"""
    expect_close(solve_exponent(1, 2, 8), 3.0, what="solve_exponent(1, 2, 8)")


def test_isolate_first():
    """5 · 2^x = 40 gives x = 3 (divide by 5 first)"""
    expect_close(solve_exponent(5, 2, 40), 3.0, what="solve_exponent(5, 2, 40)")


def test_needs_logs():
    """100 · 1.05^x = 200 gives x = ln 2 / ln 1.05"""
    expect_close(solve_exponent(100, 1.05, 200), math.log(2) / math.log(1.05), what="solve_exponent(100, 1.05, 200)")


def test_decay():
    """A base below 1 works too: 2 · 0.5^x = 0.25 gives x = 3"""
    expect_close(solve_exponent(2, 0.5, 0.25), 3.0, what="solve_exponent(2, 0.5, 0.25)")


def test_answer_checks_out():
    """Putting the answer back in gives c: 3 · 7^x = 50"""
    x = solve_exponent(3, 7, 50)
    expect_close(3 * 7**x, 50.0, what="3 * 7**x with x = solve_exponent(3, 7, 50)")


def test_negative_a_and_c():
    """-2 · 3^x = -18 gives x = 2: only the sign of c / a matters"""
    expect_close(solve_exponent(-2, 3, -18), 2.0, what="solve_exponent(-2, 3, -18)")


def test_negative_target_has_no_solution():
    """2^x = -8 has no solution, so raise ValueError"""
    assert _raises_value_error(1, 2, -8), "expected ValueError for 1 · 2^x = -8"


def test_base_one_has_no_solution():
    """1^x is always 1, so 1^x = 5 raises ValueError"""
    assert _raises_value_error(1, 1, 5), "expected ValueError for base 1"


def test_zero_a_has_no_solution():
    """0 · 2^x is always 0, so 0 · 2^x = 5 raises ValueError"""
    try:
        solve_exponent(0, 2, 5)
    except ValueError:
        return
    except ZeroDivisionError:
        raise AssertionError("got ZeroDivisionError for a = 0: check a == 0 first and raise ValueError")
    raise AssertionError("expected ValueError for 0 · 2^x = 5")

Free further reading

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