Mathematical Awakening: Connecting the Equations of Nature and Intelligence · Chapter 1 · 3 min read · code · math

Chapter 1: Building Intuition for Functions, Exponents, and Logarithms

Chapter 1: Building Intuition for Functions, Exponents, and Logarithms

Why This Chapter Matters

Before we dive into the rich landscape of calculus, it's crucial to develop an unshakable intuition for the basic mathematical building blocks — especially functions, exponential growth and decay, and logarithms. These aren't just abstract tools — they describe real-world phenomena like population dynamics, drug metabolism, economic growth, and even how your machine learning model makes predictions.

This chapter walks step-by-step through these concepts from first principles. Our goal is to give you a deep, clear understanding of what these ideas mean, where they come from, and how they naturally show up in the world around you.


1. What is a Function?

A function is a rule that connects inputs to outputs. Think of it as a machine: you put something in, it does something to it, and gives you a result. But not just any machine — a precise one: each input gives exactly one output.

📦 Function Machine Intuition

  • Input: x=3x = 3
  • Rule: Multiply by 2 and add 1
  • Output: f(3)=23+1=7f(3) = 2 \cdot 3 + 1 = 7

That's a function: f(x)=2x+1f(x) = 2x + 1

🕰 Real-Life Examples of Functions

  • Physics: A ball's position at time tt, written as x(t)x(t)
  • Finance: Interest earned based on time and principal
  • Machine Learning: y=f(x)y = f(x), where xx are features, and ff is the model

🧠 Visualizing Common Functions

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-10, 10, 400)
y_linear = 2 * x + 3
y_quadratic = x**2
y_sin = np.sin(x)

plt.figure(figsize=(10, 6))
plt.plot(x, y_linear, label='Linear (2x + 3)')
plt.plot(x, y_quadratic, label='Quadratic (x²)')
plt.plot(x, y_sin, label='Sin(x)')
plt.title('Common Types of Functions')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.axhline(0, color='black', linewidth=0.5)
plt.axvline(0, color='black', linewidth=0.5)
plt.legend()
plt.grid(True)
plt.show()

2. Understanding Exponential Functions

An exponential function describes a process where the rate of change depends on the current amount. This is the math of runaway growth — or rapid decay.

🔁 The Core Idea

If a quantity keeps multiplying by the same factor over equal time steps, that's exponential behavior.

Examples:

  • f(t)=1002tf(t) = 100 \cdot 2^t: Doubling every hour
  • f(t)=100e0.5tf(t) = 100 \cdot e^{-0.5t}: Decaying over time

🌍 Real-World Applications

  • Biology: Cell growth, virus spread
  • Physics: Radioactive decay
  • Finance: Compound interest
  • Machine Learning: Softmax, learning rates

📊 Visualizing Exponentials

x = np.linspace(0, 5, 200)
y_growth = np.exp(x)
y_decay = np.exp(-x)

plt.figure(figsize=(10, 6))
plt.plot(x, y_growth, label='Exponential Growth (e^x)')
plt.plot(x, y_decay, label='Exponential Decay (e^-x)')
plt.title('Exponential Growth vs Decay')
plt.xlabel('x')
plt.ylabel('f(x)')
plt.legend()
plt.grid(True)
plt.show()

3. Logarithms: The Inverse of Exponentials

If exponentials answer, "What happens when we multiply repeatedly?" — then logarithms answer, "How many times do we need to multiply to get a result?"

🔄 Intuition

If 25=322^5 = 32, then log2(32)=5\log_2(32) = 5. A logarithm finds the missing exponent.

🧪 Real-World Use Cases

  • pH levels (chemistry)
  • Decibel scale (sound)
  • Richter scale (earthquakes)
  • ML & Statistics: Log-likelihood, entropy, loss functions

🧮 Practical Example in Python

import math
print("Log base 2 of 32 is:", math.log(32, 2))  # Output: 5

📏 Logarithms Compress Large Ranges

One of the most important uses of logarithms is to shrink huge numbers into manageable scales.

Think about trying to graph values from 1 to 1,000,000. In a linear plot, values like 10 and 100 are practically invisible next to a million. But on a log scale, they become evenly spaced:

  • log10(10)=1\log_{10}(10) = 1
  • log10(100)=2\log_{10}(100) = 2
  • log10(1,000,000)=6\log_{10}(1{,}000{,}000) = 6

This compression makes massive ranges comprehensible and comparable.

🔬 Examples of When Scientists Use Logarithms

  • Seismologists: Earthquake energy spans trillions of joules — log scale makes this readable.
  • Biologists: Bacteria counts grow exponentially — a log scale makes early growth visible.
  • Machine Learning: Training loss may span from 1000 to 0.001 — semilog plots reveal the full training curve.

🔍 Visualization in Python

x = np.logspace(0.1, 6, 200)  # from ~1 to 1,000,000
y = np.log10(x)

plt.figure(figsize=(10, 6))
plt.plot(x, y)
plt.xscale('log')
plt.title('Logarithmic Compression: log10(x)')
plt.xlabel('x (log scale)')
plt.ylabel('log10(x)')
plt.grid(True, which='both')
plt.show()

4. Mini-Project: Population Growth and Time to Target

Let's model exponential growth and use a logarithm to answer a practical question: How long does it take for the population to reach a target?

initial_population = 100
growth_rate = 0.3  # 30% per hour
hours = np.linspace(0, 10, 100)
population = initial_population * np.exp(growth_rate * hours)

plt.figure(figsize=(10, 6))
plt.plot(hours, population)
plt.title('Bacterial Population Growth')
plt.xlabel('Time (hours)')
plt.ylabel('Population')
plt.grid(True)
plt.show()

# Logarithmic calculation to find time
target_population = 1000
time_needed = np.log(target_population / initial_population) / growth_rate
print(f"Time needed to reach 1000 bacteria: {time_needed:.2f} hours")

5. Chapter 1 Summary Sheet

🎯 Functions

  • Rule connecting input to output
  • Real-world uses: motion, finance, ML models

📈 Exponentials

  • Output grows/shrinks proportionally to current value
  • Core of models in growth, decay, and finance

📉 Logarithms

  • Inverse of exponential growth
  • Help us measure, solve, and compress large-scale data

🔢 Key Equations

  • f(t)=abtf(t) = a \cdot b^t, P(t)=P0ertP(t) = P_0 e^{rt}
  • logb(xy)=logb(x)+logb(y)\log_b(xy) = \log_b(x) + \log_b(y)

🧮 Constants

  • Euler's number: e2.71828e \approx 2.71828

Part II: Detailed Chapter Content

The following chapters provide the full, comprehensive treatment outlined in the table of contents, complete with theory, Python implementations, and practical applications.

Key Takeaways

  • Before we dive into the rich landscape of calculus, it's crucial to develop an unshakable intuition for the basic mathematical building b…
  • These aren't just abstract tools — they describe real-world phenomena like population dynamics, drug metabolism, economic growth, and eve…
  • This chapter walks step-by-step through these concepts from first principles.
  • Our goal is to give you a deep, clear understanding of what these ideas mean, where they come from, and how they naturally show up in the…
  • A function is a rule that connects inputs to outputs.
All chapters
  1. 00Preface3 min
  2. 01Chapter 1: Building Intuition for Functions, Exponents, and Logarithms3 min
  3. 02Chapter 2: Understanding Derivative Rules from the Ground Up12 min
  4. 03Chapter 3: Integral Calculus & Accumulation6 min
  5. 04Chapter 4: Multivariable Calculus & Gradients10 min
  6. 05Chapter 5: Linear Algebra – The Language of Modern Mathematics9 min
  7. 06Chapter 6: Advanced Linear Algebra – Eigenvectors, Eigenvalues & Matrix Decompositions10 min
  8. 07Chapter 7: Probability & Random Variables – Making Sense of Uncertainty21 min
  9. 08Chapter 8: From Probability to Evidence – Mastering Statistical Reasoning & Data-Driven Decision Making16 min
  10. 09Chapter 9: The Mathematics of Modern Machine Learning16 min
  11. 10Chapter 10: Reading a Modern ML Paper — DeepSeek-R1 and the Return of RL15 min