Learn (Modern) Calculus from Scratch in X Days

Intro

Here we learn some single/multivariable calculus, from the perspective of modeling with it.

Who needs this:

Everybody really since mathematical modeling and software is eating the world: biology, finance, sociology, land surveying, lab techs, any developer that wants to analyze their programs or write a game/animations, write drone or autonomous vehicle software, anybody interested in statistics or any student going to back to university.

How long will this take

No idea but I will do it ~1hr per day and see how long it takes, then the title of this page will change when I finish. I'm not doing it everyday, just noting the days total it took to complete.

Why is this 'modern' calculus

Basically for clickbait title reasons, the book we use was written in 2018 and focuses on parameters to calculus functions and modeling with them instead of your typical symbolic calc course.

I lose interest after Y days and give up

Try learning this along with a subject where you will actually use this material, such as machine learning or graphics.

Materials we will use

Every book you can think of is free from library genesis including the book we are doing but I recommend to buy the books if you can to keep as future reference since technology tends to vanish after a few years while a book remains a book hundreds of years later.

We will do:

  • The book Mathematical Modeling and Applied Calculus by Kilty & McAllister
    • Read the review here
  • This playlist that visualizes concepts in the book

I will include optional links to as we go to YouTube lectures you don't have to watch, the book is the main source.

Basic arithmetic

Even if you remember highschool this is worth watching because he writes proofs for all these objects and their arithmetic

Laws of arithmetic

NJ Wildberger has unique geometric focused lectures

Summation/series notation

Discrete summation notation and arithmetic/geometric series, this is optional you can watch it later when summation comes up. There are slightly different properties for 'infinite convergent series' we'll learn those later too.

Note use of brackets:

  • \(\sum_{i=1}^n\) i + 1 = (1 + 2 + 3..) +1
  • \(\sum_{i=1}^n\) (i + 1) = (2 + 3 + 4..)

The summation rules ~@10:30, expand the sum/remove the sigma notation and the rules make sense

  • \(\sum_{i=1}^{3}ca_i\) = c1 + c2 + c3
  • c\(\sum_{i=1}^{3}a_i\) = c1 + c2 + c3
  • c(1 + 2 + 3) = c1 + c2 + c3

Write your own examples for the constant difference rule of an arithmetic sequence:

  • Sequence a3 = 101, 202, 303
  • Example index a1 = 10, a2 = 20 ..
  • d = (20 - 10) = (30 - 20) or d = 10
  • To find a4:
    • a4 = a1 + d(k - 1)
    • a4 = 10 + 10(4 - 1)
    • a4 = 40

Do the same for arithmetic series:

  • \(\sum_{k = 1}^n (a_1 + d(k - 1))\)
  • n = 4: (a1 + d(0)) + (a1 + d(1)) + (a1 + d(2)) + (a1 + d(3))
  • n = 4: 4a1 + d(0 + 1 + 2 + 3)
  • n = 5: 5a1 + 10d
  • n = 6: 6a1 + 15d
  • n = 7: 7a1 + 21d
  • na1 + d(n2 - n)/2
    • 5a1 + d(20/2) = 5a1 + 10d

Trigonometry

Try the Brown University trig bootcamp in summary there are 3 triangles who's measurements you should know, you scale them down to the unit circle size, and then use them to figure out points on the unit circle ie: trigonometry. The same page includes a full solution video to the psets. I've already done this here in detail.

Pi There are many tutorials about pi appearing in geometric series here or if you want a interesting pi lecture where Wildberger made his own recursive formula for pi/16 to generate successive digits watch this if you're curious.

How the US olympiad coach teaches problem solving

Let's watch an example of how the current US IMO coach Poh-Shen Loh figures out a problem: click here and skip to 31:30 to start CMU's Putnam competition seminar. We're starting with question 3: The polynomial p(x) has all integral (meaning an integer) coefficients. The leading coefficient, the constant term, and p(1) are all odd. Show that p(x) has no rational roots. A root means some input x for p(x) = 0, move everything to the left side, equate it to zero and solve for the unknown x. Many never have a root, so we use a trick called complex numbers to find a root. We learn this in the math workshop using a Russian olympiad basic algebra book.

A polynomial recall from highschool looks like p(x) = 5x2 + 3x - 1 or you can think of it as many monomials like \(x^n\) grouped together with addition/subtraction/multiplication/division in other words algebra, and a constant like 5 or 1 is also a monomial too since 5x0 or 1x0, the zero exponent by rules of exponents is substituted for 1, so really this is 5(1) or 1(1) because no matter what you substitute for x, it will be 1 anyway since the exponent is zero. Google modeling with polynomials to see why they exist in chemistry, physics, engineering or encoding with polynomials as a way to encode information about some other object. Wildberger has a two part History of Mathematics lecture series here worth viewing if you want to know the origins of this math or how ancient Greeks solved square roots using a compass and a ruler.

@32:00 he asks for tiny, tiny ideas. You are a detective trying to figure something out, and just throwing out ideas and writing them down. Reminder the coefficient in 5x is 5. @35:00 or so he comes up with a possible strategy: eliminate the odds, eliminate the evens, now you've removed any possible of being an integer ergo it's not rational because of the above Wildberger lectures where a rational number is constructed from integers.

@37:00 he uses the term 'implies'. What does this mean? This is mathematical logic you can read here written by Swiss logician and type theorist Per-Martin Lof on the justifications of all these logical terms like implies, conjuction, disjunction, what a proposition is etc. This is the logic you use to deduce math.

Casually watch the rest of this seminar, this is how you do problems. It's an investigation throwing out very tiny ideas and playing around with these ideas until you know more about the problem and possibly solve it. I already watched it here and explain how he cleared the fractions if you're confused as he flies through that part in the lecture.

Future Practice Oxford's underground mathematics is a site with a subway theme that gives you practice questions and solutions. There is also a free pdf Preparing for University which is to train the reader in 'advanced mathematics' needed for undergrad study later. Every page is a problem with a fully worked out solution.

How to get peer help

Write a question to math stack exchange. Often you will end up figuring it out yourself because the process of posting requires you to precisely write down your problem or they will delete it for being too vague. This style of learning has a name: inquiry-based learning.

Begin here: Calculus overview

The essence of calculus is a 17m overview with visualizations to intuitively explain how calculus works like the area of a circle is determined by an approximation of summing up tiny values. You may only need this video for the entire book it's highly recommended.

The language of calculus is a an optional extra 30m overview of calculus with Mandarin subtitles written for foreign students in the Australian university system. Wildberger goes through the physics interpretation like velocity, acceleration, etc. He shows how one function can tell you how another is changing by taking it's derivative or by integration, how they are inverse operations.

Day 1 Functions

Reading Chapter 1.1 of Mathematical Modeling and Applied Calculus. Skim this chapter it probably contains things you don't remember. You can always jump to the end of chapter exercises and try enough of them to justify skipping this chapter but this is a different book than most math texts and often has important things to point out that we will come across in later chapters.

In case you forgot highschool and the Cartesian plane, the inputs are the horizontal line and outputs are the points on the veritcal axis. All this does is conveniently represent an input/output relationship with a visualization of displacements.

We are also introduced to our first math data structure, a tuple or an ordered pair of values enclosed in brackets like (1, 2). This is similar to the idea of a list in programming, somebody needed a way to represent values in math in which the order matters and duplicates could be possible like (3, 3), so invented a tuple structure.

Page 8: Question 2: obviously (c) and (b) have numerous y outputs for a single x input. The definition on the same page claims 'every function in this book is contained in the real numbers' which you can read about in the math workshop if you're interested. Rationals, integers and natural numbers are all contained in the real numbers but complex numbers or whatever other number object abstractions aren't.

Example 4(c), they throw in set theory notation (union) without defining it. If you're interested watch a lecture on sets and functions. They also use interval notation without defining it which you can search for on YouTube yourself.

Question 4: Identify the domain of each function. (a) clearly can be anything, (b) can be any negative number, since 4 - (-4) is 8, and 0, 1, 2, 3 to avoid being a negative square root, so (-inf, 4) if we are using interval bracket notation to exclude 4. (c) every single input maps to the same output, so it's domain is the entire 'real numbers'.

Example 5 is much easier if you include brackets f(x) = \((3)\sqrt{x} - 5\) now you know exactly what to do, take the square root of x and multiply it by 3 and subtract 5. Anytime you see math notation jumbled together like this it means multiplication but brackets are never included for some reason.

RStudio

Reminder we are just using RStudio as a glorified calculator, you don't need to know how to program and can easily figure this out yourself. The working in R studio aside you can do this online instead of having to install anything locally if all you have is a phone, meaning work in your browser if you want. The instructions are in the appendix, make a throwaway gmail account, open new project on r studio, first thing you type:

install.packages(c("MMAC", "mosaic", "mosaicCalc", "manipulate"))

The 'c()' is a "vector" meaning multiple inputs to the install.packages() command. This command is actually install.packages(c) where c is filled with entries. Then you have to include all these libraries as written in require statements in the aside on page 12:

require(MMAC)
require(mosaic)
require(mosaicCalc)
require(manipulate)

Which means if you're using the console, where you type in something and it evaluates each line, then you have to paste in those require() statements to let the program know where to look to use those built-in functions like 'mosaic'. These libraries 'MMAC, mosaic' etc are mainly data sets the book uses in later chapters we will import and then model.

I rewrote Example 7(d) to make it more clear:

abs( (2^3 / 4^5) - (9^8 / 6^7) )

I'm not sure why they use (23)/(45) style brackets but whatever, either works. This command is actually abs(thing) where thing = ((23 / 45) - (98 / 67)) and now you are getting the gist of programming. I also rewrote the aside on page 13 from f=makeFun(8*x+4~x) to the following to make it more clear, translated this means make f a function, where the body is 8*x+4 and the parameter for f is x.

> f = makeFun( ((8 * x) + 4) ~x)
> f(3)
[1] 28

And I rewrote the plotFun example, translated this means plot function ((-4 * x) + 8) where the input is x, and limit the visual range to (-5,5)

plotFun( ((-4 * x) +8)~x,xlim=range(-5,5) )

Question 9 Graph a line with a specific domain in RStudio:

> line = makeFun(((-3.546 * x) - 9.128)~x)
> plotFun(line(x)~x, xlim=range(-15,15))

Try experimenting with syntax
This works too because we already declared line a function with (x) input
Translated: plotFun(function, display-options)

> plotFun(line, xlim=range(-15,15))

Pyret

You can do this entire book in Pyret as well if you've already done the software workshop, or read a few chapters from this, using https://code.pyret.org/ web page to write and run code. You can use built-in libraries like num-abs() or rewrite everything yourself. Here's rewriting some of the book's R examples and you can plot function graphs in Pyret too or use Desmos:

Day 2 Exercises

Trying some of the chapter 1.1 exercises. The only non-functions I see in Ex 7-14 are 10, 13 and 14 because the same input has different outputs (3.14 is not the same object that pi is). All of these you can answer in your head in a couple of seconds.

Ex 34 can be rewritten \(\sqrt{x}\) + \((1 + x)^{\frac{1}{4}}\) search for rational exponent rules. We can't have a negative square root so you have take into account \(\sqrt{x}\) meaning the domain is the entire positive real numbers and zero.

Try changing all these exercises to an equivalent form from the Wildberger basic arithmetic lectures in the beginning of this workshop. For example Ex 37 can be rewritten \(\frac{\pi}{x^2 - 9} \cdot \frac{x}{x}\) and now it's obvious what to cancel to simplify this problem to a domain that avoids x2 - 9 being 0.

Ex 35 we only care that the denominator is not 0, since a/b + c/d = ad/bd + cb/bd then the denominator is 4x2 + 20x or 4x(x + 5) and x can't be -5, or else we get 4x(0) which is 0 or -20(-5 + 5) which is 100 - 100 or 0.

I like exercises 91 to 100 where you have to in your own words explain all the topics the chapter presented. This is known as the Feynman method where you attempt to explain concepts to an invisible audience in the most simplest terms anybody can understand, and if you find yourself stumbling then you go back and reread those concepts, or practice some exercises until you can effortlessly explain 91 through 100. When you explain to yourself, remove any words like conjecture or even data. Imagine somebody is sitting in front of you asking you to define every word you use, and wants to know exactly what data means (tip: they often will do this in those annoying software developer interviews). It took me about an hour to do a random sampling of the 100 exercises for Chapter 1 so congrats, you're done for today.

Day 3 Multivariable functions

There are visualizations for chapter 1.2:

Easy chapter you can skim assuming you watched the above YouTube videos, here f(x,y) returns a z-axis point. Example 9, where they 'simplify using properties of exponents' they also break that fraction up to an equivalent form, just like \(\frac{5}{7d}\) is equivalent to 5/7 \(\cdot\) 1/d.

  • L = \((\frac{C}{1.01})^{4/3} \cdot (\frac{1}{K^{1/4}})^{4/3}\)
  • L = \((\frac{\sqrt[3]{c^4}}{\sqrt[3]{1.01^4}}) \cdot (\frac{1}{k^{1/3}})\)
  • if C = 5: \((\sqrt[3]{(5 \div 1.01)^4})\) or ~8.44

1.2 Exercises

Nothing here that wasn't already covered in the contour plot video, like Ex 57-62 matching 3D graphs to their contour plots. I did another sampling of exercises again not all 90+.

1.3 Linear functions

This chapter is a review of linear functions you probably already know from highschool, Parameters of Linear Functions is interesting showing shifts and the section on Monotonicity which will come up again. Their definition of monotonicity has no concrete examples, but if (a, b) is an interval, then c and d are two numbers within that interval, and if c < d then f(c) < f(d) means the function is increasing. ie interval (1, 10) for f(x) = x + 1 and f(5) < f(6) ergo this is an increasing function.

Summary: the parameters m and b in y = mx + b

  • b is a shift on the y axis up or down
  • m is the slope of the line either positive or negative

Day 4 Exponential functions

Before you read this chapter watch this tutorial about the constant e why it's often used to model something who's growth is itself, especially the end of the video where he shows how since all ak functions behave the same as e, we just end up modeling with e and some parameter(s). We haven't learned the chain rule or derivatives really yet except the beginning crash course vids so you can skip those if you want and still be able to understand most of the tutorial.

Parameters for C\(e^{kx}\) or C\(e^{k(x-h)}\)

  • C is the y-intercept (shift along y-axis)
  • k affects the steepness (slope)
  • x is the function input
  • h is a horizontal shift on the x-axis
    • never crosses the x-axis as y is never equal to zero

There must be errata for Example 6, Figure 12. If f(1) = ek1 if k is negative you get y = 0.367 which clearly is graph(b) going down towards x-axis, because e-kx results in y = 1/ekx meaning y gets smaller and smaller. If you input x = -1, with negative k you get graph(b) again. Skim rest of chapter, like the exponent rules if you forgot them. You don't have to memorize the formulas for halving or doubling time since you can always come back here later and look them up.

Statistics example of ex parameters

Look up 'bell curve' or 'normal distribution'. A picture is here. The formula is:

\(f(x) = \frac{1}{\sigma\sqrt{2\pi}} \exp\left( -\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^{\!2}\,\right)\)

or equivalent ex notation:

\(f(x) = \frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}\)

C = \(\frac{1}{\sigma\sqrt{2\pi}}\), k = -1/2, and x is being shifted by h = \(\mu\)

Type this into desmos and move the slider around. Notice parameter h, (here it's mu or \(\mu\)), the horizontal shift, determines the middle of the bell curve, in other words the mean. Parameter C, the y-intercept moves up and down the y-axis as you change it. Parameter k, when h is negative, k is positive, since -1/2 * -2 is 1, so all x inputs that are negative are concave up or climbing, and all positive x inputs are negative concaving down to give the bell curve. Everything else like squaring the inputs, dividing by C (here the standard deviation), is finessing of the data to construct that model you can play around with too in desmos to see how it works.

1.5 Inverse functions

This is the setup for understanding log(). Can quickly skim this chapter: horizontal line test, montononic functions have inverses, find the inverse by inputting the y output and getting original x input, etc. I don't really get what the chapter refers to as 'book keeping convention of change of variables', example 9 if you want an inverse function to y = 4x - 7 then x = 0.25y + 1.75 is what you want instead of y = 0.25x + 1.75 because then you are solving for x all over again if 2 = 0.25x + 1.75 instead of x = 0.25(2) + 1.75, and the whole point was to reverse y and get the original f(x) inputs. Maybe this is explained in future chapters.

Exercises 81 - 94 you can also type into desmos.com for example Ex 90.

Day 5 Logarithm fundamentals

To make the reading of chapter 1.6 faster there is a great workshop here that starts ~14m in, as you watch it and he asks questions pause and input your own examples. The workshop isn't the full 1:32:55 you can skip the time waiting for students to answer quizzes or the Q&A. Since this is an hour or so of work you're done for today.

Day 6 Logarithmic functions

Chapter 1.6 Logarithmic functions.

Parameters of logarithms.

  • y = C(ln(x - h)) + v
    • v is a vertical shift
    • h is the horizontal shift
    • C is the magnitude/rate of increase

There's some easy examples substituting log rules for each other, these come up all the time in solving recurrence relations in algorithm/discrete math courses.

Let's try question 5: find the equation of the exponential function passing through points (0,-4) and (3,-24). Stare at the laws of logarithms and reduce/substitute:

  • y = Cekx
    • -24 = -4e3k
    • 6 = e3k
    • ln(6) = ln(e3k)
    • ln(6) = 3k
      • 6 can't be manipulated into one of the log laws
    • k = ln(6)/3
      • y = -4e\(\frac{ln(6)}{3}x\)

Graph it with desmos here I added a second graph to play around with h parameter. Skim the semi-log and log-log plots material then you can safely skip to the end of chapter summary. The exercises again take a random sampling if you feel like it, you don't have to memorize all the laws of logarithms just be aware they exist, and you can come back to this chapter later to manipulate them as per log laws when you encounter them. As usual Ex 97-102 are the best where you have to explain yourself the chapter material like C is the magnitude parameter, h is the horizontal shift.

Day 7 Trig fundamentals

Let's watch Trigonometry fundamentals from Lockdown math episode 2, every question he asks refer to chapter 1.7 Trig Functions which is a short chapter. All the workshop quizzes are in the text, like cos(pi/3) = 1/2.

There's errata in the book chapter, Example 3 is filled with errors, should be 3pi/4 = 135deg not 5pi/4 which is 225deg. It then mixes up the signs for 5pi/4 with 3pi/4 but looking at Figure 5 you can figure out what the correct example should be.

Algebra reminder:

  • \(\frac{1}{\frac{\sqrt2}{2}}\) = \(\frac{1}{1} \cdot \frac{2}{\sqrt 2}\) = \(\frac{\sqrt 2 \cdot \sqrt 2}{\sqrt 2}\) = \(\sqrt 2\)
  • 2 is \((\sqrt 2)^2\) or \(\sqrt 2 \cdot \sqrt 2\) since \(\sqrt 4\) = 2

The book provides trig identities that we learned in the Brown bootcamp, and really that's it, the exercises primarily are plug and play or graphing functions on desmos or in R to see how the identities work, which for the most part the lockdown math lecture already provided for us.

There is an interesting visualization at @59:30 that show how cot() and tan() are represented geometrically. This is a two-part video with a promise that studying complex numbers in the next video will better explain trigonometry.

Land Surveying

Some optional extra trig material for practical use in astronomy or land surveying

Ancient Mesopotamia surveying

Wildberger has an ancient trig lecture here (22m) on 4000 year old Babylonian surveying, apparently trig originates from land taxation and ownership disputes even before they wanted to start building pyramids and ziggurats and was an offshoot of ancient people who wanted to map stars and predict eclipses.

Spherical trigonometry

Wildberger explains here the spherical trig of astronomy that influenced planar trig. If you are wondering why sine/cosine is a rotation around a unit circle, why we have tan(x) function, this explains it.

Day 8 Complex numbers (Trig part II)

This workshop is part 2 of trig fundamentals and is optional, we finished the first section of the book which is 105 pages in 7 days and are now on to section 2 Mathematical Modeling but this workshop will further explain trig identities. Alternatively, the Wildberger rational trigonometry lectures also contain complex numbers defined as dilations (stretch) and rotations. His later complex number lectures make the concept of i2 = -1 trivial, he defines i as a 2x2 matrix that when multiplied by itself produces -1.

If you're confused watching the lockdown math lecture, the Geogebra visualization at around 30:55 emphasizes how everything stretches and rotates. The quiz @45:53 is a trig identity, cos(pi/6 + pi/4) or cos(α + β) = cos(α)cos(β) – sin(α)sin(β) all the inputs are in figure 5 on page 111 and he derives it from complex number multiplication. @1:09:09 the quiz solution is obvious if you again look at figure 5 on page 111.

Day 9 The exp() function part 1

Since we are going to rapidly do the math modeling section of the book, we have some extra time, so may as well watch the next lockdown math lecture about eix since it provides a model of sin/cos functions as a weighted sum of the exponential function and teaches the properties of exp() we will have to learn later anyway.

Watching lockdown math workshop 4 What is Euler's formula actually saying?. We learn ex is really exp(x) and all the parameters still apply like C(exp(kx)). @16:24 the first quiz, reminder that if f(a+b) = f(a)f(b) then we have the rules of exponents, since 23 \(\cdot\) 24 = 27 and 27 = 23+4, so every option in the quiz is true though he has a moment of confusion that ends up being 1/e * e or e/e which is 1 and still satisfies exp(-1 + 1) = exp(0) = 1.

Quiz @ 27:30 is a Khan Academy lesson but his geometric explanation you can easily see it is -i.

Try it yourself: i-1 = 1/i

  • 1/i = i4/i because if i2 = (-1) then i2 \(\cdot\) i2 = 1 which is 1/i
  • 1/i = i3 because i4/i is i3
  • 1/i = i3 = (i2 \(\cdot\) i) or ((-1) \(\cdot\) i) which = -i.

Summary: \(\frac{1}{i} = \frac{i^4}{i} = i^3 = (i^2 \cdot i) = (-1 \cdot i) = -i\)

When he shows the visualization of exp(i(theta)): i moves up, i2 is -1 so moves left, i3 is -i so moves down..the @40m quiz asking what is e3i, we can rewrite this as exp(i(3)) and besides him already showing us roughly what this value is @38:40 where theta = pi, recall figure 5 on page 111 of our book and see that pi on the unit circle is -1, so since e3i is close to e3.14..i it's going to be a slightly positive i and nearly -1 value for x. Of course this is also cos(3) + i(sin(3)).

Homework 1: expand exp(x)exp(y) or exey or ex + y and show every term has a form of \(\frac{x^{k}y^{m}}{k!m!}\)

The formula for exp() is:

\[exp(x) = \sum_{k=0}^{\infty} \frac{x^k}{k!} = \frac{x^0}{0!} + \frac{x^1}{1!} + \frac{x^2}{2!} + \frac{x^3}{3!} ..\]

Recall the lecture on Summation/series notation. So what is exp(1)exp(2), since this is ee2 it should be e1+2 we will cut off at 2 though in practice you would never do this as you need numerous entries in the series for precision:

\[exp(1) = \sum_{k=0}^{2} \frac{1^k}{k!} = \frac{1^0}{0!} + \frac{1^1}{1!} + \frac{1^2}{2!}\] \[exp(2) = \sum_{k=0}^{2} \frac{2^k}{k!} = \frac{2^0}{0!} + \frac{2^1}{1!} + \frac{2^2}{2!}\]

Now show every term is actually \(\frac{x^{k}y^{m}}{k!m!}\) for exp(1) \(\cdot\) exp(2):

\[(\frac{1^0}{0!} + \frac{1^1}{1!} + \frac{1^2}{2!})(\frac{2^0}{0!} + \frac{2^1}{1!} + \frac{2^2}{2!})\]

You're done, this shows each term as \(\frac{x^{k}y^{m}}{k!m!}\) after you FOIL everything out and collect them under similar denominators at least, I think that's what he's asking.

Homework 2 requires remembering the binomial theorem or n choose k, and #3 is to compare both results to convince yourself that exp(x + y) is roughly exp(x)exp(y) because exp(x) ~ ex so exp() should act like an exponent with the same laws. Homework 4 req watching his linear algebra playlist, and everywhere exists notes or youtube tutorials on the complex exponental: exp(iy) = 1 + iy + (iy)2/2!… where all the positive terms become cos() and negative terms become i(sin()) since i2 = -1 and i3 = -i etc. Basically you end up proving the thumbnail in this lecture if you try it.

The exp(x) for matrices is explained in the next lecture @59:08 if you're curious. Matrices don't commute when you multiply them.

Day 10 The exp() part 2

A last and optional workshop on ex introduces the limit definition of ex. Reminder imaginary i is \(\sqrt{-1}\). I chose this because you get an intuitive definition of limits, change and continuous math, plus a crash course in acceleration. All central topics in calculus. The question @43:50 'x nought' or x0, all this means is an arbitrary distance, so instead of inserting a concrete distance of say 12, you abstract this to say it's x0 because the actual value doesn't matter.

I also liked this lecture because he substitutes a lot of equations to make them simpler, such as assigning a complex expression to z, or change in z = -1 * z * change in t. In the other math workshop, the Putnam seminar repeatedly uses this strategy to assist with proofs and simplify them.

Day 11 Mathematical modeling

Let's read through most of chapter 2. I'm not doing any of the exercises here because I'm already taking machine learning courses where we will program these models on a regular basis, when needed I'll return and try some exercises.

2.1 Linear function modeling

How do we know if data fits a linear model? Check the slopes are approximately similar at different points, y/x or rise/run, take the average of the slopes minus the one you couldn't include since you don't know the y4 - y3 value if only given data up to y3. Once you get the slope iterate through all y points to solve for b, reminder b is the shift up and down the y-axis, average these and now you have y = mx + b with m and b known and can plug in all your data.

2.2 Exponential function modeling

We verify if exponential models are a reasonable data fit by plotting it (x, ln(y)) which produces a linear straight line if ex is the model that fits the data, otherwise we get a curved (non-linear) line. I interpret 'nonconstant' linear meaning you have a variable in there that changes, and not just a constant like y = 5 or else you get a linear flat line no matter what.

Page 142 there's a good breakdown why this works:

  • ln(y) = kx + (-kh + ln(C))
  • this is of course y = mx + (b) since k is the slope

Should this test for linearity using ln(x) work, our semi-log model of y = m(x - h) + b gives us the parameters for the exponential model where m = k (slope), and C = eb, so ebekx. There's a remark that if you're dealing with -C parameter, you take the absolute value and see if it's linear since ln(x) it's domain is the positive real numbers, so ln(-C) is undefined. I skimmed the rest of the chapter, good advice here how to shift the data to fit the model using the h parameter. If I need this model I'll return to this chapter later.

2.3 Power function modeling

Power functions are y = Cxk where k and C are constants. Example: y = x is a power function: y = 1x1 or Cxk.

Many of the examples here reinforce the laws of exponents, showing you how to manipulate power function equations. The test for identifying a power function model fits the data is to take the log-log plot or (ln(x), ln(y)) and the result should be approximately linear. They again show reasoning in steps why this works on page 164, the last line being ln(y) = kln(x) + ln(C) and again this is y = mx + b. This test fails however if the input or output to ln() function are negative values, we can't just take the absolute value like we did with exponential models, and are told we're screwed and the solution is beyond the scope of the book. Chapter ends talking about logarithmic scale plots, where spacing between values on the x/y axis changes logarithmically, so you can show bigger inputs/outputs on smaller graphs.

2.4 Sine function modeling

If you watched the 3blue1brown lecture above on trig fundamentals, we already saw him adjusting sin(x)/cos(x) parameters in desmos.

Parameters: \(Asin[\frac{2\pi}{P}(x - h)] + v\)

  • A = amplitude
  • P = period
  • h = horizontal shift on x-axis
  • v = vertical shift on y-axis

Try it out in desmos to see what each parameter does.

2.5 Sigmoidal function modeling

To understand the parameters use desmos again and adjust them. These kinds of functions come up everywhere, for example a logistic function where the S curve on the y-axis is between 0 and 1, and now any real number you input the output is a probability since a probability space adds up to 1.

2.7 Dimensional Analysis

'Dimensionaless' means a scalar, or c1 like 1, 2, 3. The number line is 1-dimensional, cartesian (x,y) plane is 2-dimensional, 3-dimensions is (x,y,z) etc.

This whole chapter is about combining dimensions to get a new dimensional result, not the concrete values. Example 3(a): 55mph is the product of either LT-1 where T=1 for 1 hour, then L*1*0.5 is the answer or T = 60m then 55/60*30 to get the same answer, which is a distance dimension. Using purely dimensional arithmetic, you get LT-1T which is just L, the distance travelled and same dimension we ended up using concrete values.

Ex 4(a): 4bc where b=T and c=LT-1 the 4 being a scalar becomes 1 because we are working at the dimensional level, and the answer is L since LTT-1 is LT/T or L*1.

Skim the rest of the chapter noting you may have to come back here later if ever working on dimensional analysis, or after we learn linear algebra because since we are just working at the level of exponents, they have the same arithmetic as vectors do. The section on solving three linear equations for three unknown exponents is a simple linear algebra problem as well.

Day 12 Method of least squares

This chapter is optional, you can skip to Chapter 4 Derivatives if you want to get to calculus. From chapter 3.1 to 3.4 is a linear algebra crash course. All the vector operations examples in the book you can write as small toy programs, for example like I did here in Pyret or you can do in rstudio.

The last determinant lecture doesn't really show you how it's actually calculated, though this will:

We are only watching enough of this lecture to understand the determinant in the book which is kind of given without explanation. Start at the beginning of the lecture.

  • Up to 6:20 he shows how you would think about calculating the area of this special case
  • @8:40 this is the determinant ad - bc of a 2x2 matrix

You can stop watching at 12:00, though the lecture will go on to define 3D determinants which you can do if you take the linear algebra workshop

3.5 Method of Least Squares

If the data is not linear, make a linear approximation y = mx + b. Good chapter if you've never seen this before, page 336 Understanding the Method of Least Squares explains what is happening geometrically which is a projection to make it linear like mapping a shadow from 3D to the 2D cartesian plane.

Day 13 Derivatives

We finally can learn calculus.

  • A visualization (17m) to explain average and instantaneous rate of change.

@2:03 s(t) distance function is a sigmoidal function, v(t) velocity function changes based on how s(t) changes, and v(t) looks a lot like a probability normal distribution. Skimming through chapter 4.1 Rates of Change from the math modeling book, example 3 to find the instantaneous rate of change, you are shrinking that ds/dt triangle in the 3Blue1Brown videos to almost a point instead of an interval, and approximating the value to 5. Tangents are explained as a limiting of secant lines that are drawn with smaller and smaller intervals.

The RStudio examples, on page 357 I rewrote the syntax they've been using to more generic R syntax:

f <- function(x) {
  (6 * x^3) - (3 * x^2)
}

AROC <- function(a, b) {
  ((f(b) - f(a)) / (b - a))
}

AROC(2,3)
>> 99

If you are using rstudio cloud, Ctrl-Alt-r runs all your code, and in the bottom console you can enter AROC(2,3).

The corresponding chapter is 4.3 Derivatives of Modeling Functions.

  • linear differentiation: f(x) = mx + b
    • f'(x) = m
    • the derivative of a line, is it's slope, think of the small triangle 3Blue1Brown drew to represent a 'slight nudge' and a straight linear line is going to have the same 'triangle' or rise/run slope

This chapter provides, without proofs the rest of the modeling functions derivatives like how the derivative of ex is ex. If you expand the geometric series of ex and do a power rule derivative on each term, you end up with ex however there were many other functions not covered, which we will cover in depth.

The Derivative is a function that consumes other functions and returns a function

If you did the software workshop, I assume you can understand this writeup that explains derivative math notation. Summarized below:

\[{\frac{d}{dx}} x^2 = 2x\]

dy/dx or d/dx consumes functions like p(x) = x2 + 3x + 5 and returns a new function p'(x) = 2x + 3 even when we only have a constant returned, such as d(2x) = 2 then what that really means is d(2x) returns p'(x) = 2 a function that returns 2 for all inputs x.

Day 14 Derivatives of modeling functions

TODO

Day 15 Chain rule, partial derivatives

Chapter 4.4 of the book. TODO

Day 16 Limits

TODO


Home