
Calculus for mathematicians (1997) [pdf] - bumbledraven
http://cr.yp.to/papers/calculus.pdf
======
bandrami
The hardest ( _ie_ , best) math prof I ever had (I was in EE, he was in the
math department) used to say that "engineers can teach calculus, but their
students cannot go on to teach calculus". I'm impressed by someone who knows a
subject deeply enough to take that long of a view.

Personally, I just _like_ the engineering view of dx and dy as simply being
new variables (with caveats that we immediately forget). Which is why I'll
probably not teach calculus any time soon.

But, still, the best "revelation" moment I had was when he off-handedly said
"An integral is the inner product of a function and a suitably-dimensioned
unit". Light bulb came on, and I "got" integration for the first time. Too bad
they can't lead up to it that way in high school.

(Side rant: why do they teach trig _before_ calculus in high school? That's
completely backwards. Trig is a bunch of arbitrary formulas if you don't have
the calculus behind them.)

~~~
rndn
> _An integral is the inner product of a function and a suitably-dimensioned
> unit._

Does that mean that ∫f(x)dx is f.(dx, dx, …) = f(x_0)·dx + f(x_1)·dx +
f(x_2)·dx + … for all x in the domain?

~~~
stephencanon
Integral[f(x)g(x)dx] defines an inner product on a space of functions
(glossing over exactly what functions) on an interval. So Integral[f(x) dx] is
the inner product (f, 1), where "1" is the constant function g(x) = 1 on the
interval.

~~~
rndn
So ∫f(x)g(x)dx = (f.g)·dx?

~~~
stephencanon
No, f·g = ∫f(x)g(x)dx.

~~~
rndn
But don't you need to account for the width _dx_ of the slices you sum up?
I.e. wouldn't f.g = f(x_0)g(x_0) + f(x_1)g(x_1) + … over a real interval blow
up?

~~~
JadeNB
The point is that f.g (or, as a mathematician or physicist might write it, ⟨f,
g⟩ or ⟨f|g⟩) has no independent meaning, but must be _defined_ ; and one way
to define it (for `L^2` functions, the only one compatible with the `L^2`
norm) is as stephencanon did at
[https://news.ycombinator.com/item?id=9620263](https://news.ycombinator.com/item?id=9620263)
.

~~~
bandrami
Well, it's not just any arbitrary definition, it's the projection of f onto g.
Intuitively, sum(f_i * g_i).

~~~
JadeNB
> Well, it's not just any arbitrary definition, it's the projection of f onto
> g.

'Projection' also has no intuitive (EDIT: I meant 'intrinsic') meaning; "inner
product" is the same structure as "projection + norm" (subject to appropriate
axioms). Anyway, I didn't mean to claim that the definition was arbitrary, but
rather that there was no way to argue against it: definitions can't be wrong
(at worst, they can be infelicitous, uninteresting, or uninhabited).

> Intuitively, sum(f_i * g_i).

I think rndn
([https://news.ycombinator.com/item?id=9621422](https://news.ycombinator.com/item?id=9621422)
)'s objection applies to this intuition: to get a reasonable approximation of
the integral, you need a lot of sample points, and any sum that doesn't take
into account the spacing of those sample points has a good chance of
diverging. (Consider f = g = 1, so that the sum is just a count of the number
of sample points!)

Once you write sum(f(x_i) * g(x_i) * (dx)_i), of course, this becomes just
notation for (a sequence of) Riemann sums, whose limit is by definition the
integral (for continuous functions).

~~~
bandrami
Sampling has nothing to do with this. The inner product of f (x) and g (x)
simply is the integral with respect to x of their pointwise scalar products (I
suppose in a very broad sense "pointwise" could be seen as analogous to
sampling, as could "with respect to x", but the Calculus Gods will smite any
who think of dx as a sample of x). The "ah ha" moment was in seeing inner
product as the fundamental operation and integration as derived from it.

~~~
JadeNB
> I suppose in a very broad sense "pointwise" could be seen as analogous to
> sampling

Indeed, I don't understand how it could be otherwise. To multiply functions
pointwise, you need to know their values at points. It seems to me that
'sampling' is a very good word to describe the process of evaluating a
function at a lot of points.

> as could "with respect to x", but the Calculus Gods will smite any who think
> of dx as a sample of x

Indeed not! It is the _spacing_ between sample points. That is, the `dx` in an
integral literally stands for the "ghost of [the] departed quantity" `x_{i +
1} - x_i` (and, in an infinitesimal approach to calculus, it doesn't just
stand for but literally _is_ such a difference).

------
j2kun
As much as I respect djb, the title is a huge misnomer. If you're a
mathematician you _want_ analysis and topology. You want definitions of
continuity and differentiability that generalize nicely to arbitrary
dimension, to manifolds, to Lie groups, to whatever. You want to marvel at the
connections between certain special integrals and infinite sums, and you want
to see the full construction of the real numbers for its own sake. You want a
list of equivalent definitions of differentiability so you can get a better
intuition and use whichever one is the nicest for what you're trying to do.

In a very strong sense, writing a document that "focuses purely on calculus"
is antithetical to mathematics.

------
jordigh
Hm, I always thought Spivak was calculus for mathematicians.

~~~
cottonseed
Apostol, I would have said. That's what MIT's 18.014 Calculus with Theory
uses, for example.

[http://ocw.mit.edu/courses/mathematics/18-014-calculus-
with-...](http://ocw.mit.edu/courses/mathematics/18-014-calculus-with-theory-
fall-2010/Syllabus/)

------
eccstartup
I am amazed at seeing that the limit is defined by continuity. It is
interesting.

~~~
bumbledraven
_99\. Expository notes_

 _Common practice in calculus books is to define continuity using limits. I
define limits using continuity; continuity is a simpler concept._

~~~
eccstartup
Are they equivalent? Or both systems work smoothly?

~~~
dirkt
Continuity in the topological sense implies continuity by limits. For
topological spaces with a countable (local) basis, the converse is also true.

So, in general it's not equivalent. For the reals etc., it is.

~~~
cottonseed
They are equivalent if you consider limits of nets rather than limits of
sequences.

------
amelius
How difficult would it be to write this in a formal system? How much space
would it take?

~~~
jojo3000
Even defining the real numbers is already quite involved, for example in
Isabelle/HOL it is introduced as quotient over Cauchy sequences:

[http://isabelle.in.tum.de/dist/library/HOL/HOL/Real.html](http://isabelle.in.tum.de/dist/library/HOL/HOL/Real.html)

This is the classical way (and similar to HOL Light or HOL4). AFAIK in Coq the
standard way is to introduce the reals axiomatically.

The bottom theories in
[http://isabelle.in.tum.de/dist/library/HOL/HOL/](http://isabelle.in.tum.de/dist/library/HOL/HOL/)
are all about classical real analysis, based on topology and real-normed
vector spaces.

~~~
mafribe
I wonder if the coinductive approach calculus by Pavlovic et al [1, 2] has
been considered as a basis for formalisation.

I secretly hope that I will one day get to teach calculus to computer
scientists. In that case I would introduce reals as a coinductive data type,
and the usual operations (such as differentiation, integration, solving
differential equations) as stream operations. That should appeal to
programmers, athough it would be weird for conventional mathematicians.

[1] D. Pavlovic, M. Hölzl Escardo, Calculus in coinductive form.

[2] D. Pavlovic, V. Pratt, The continuum as a final coalgebra.

~~~
tel
I haven't read the paper, but if you define the reals as constructive Cauchy
sequences you'd be forced into a coinnductive definition. Is that equivalent?

~~~
mafribe
I'm not familiar with constructive Cauchy sequences. The usual way of using
Cauchy sequences is to quotient them by the ideal of Cauchy sequences that
converge to 0.

~~~
tel
I've seen an impl somewhere where the (int => rat) bit from the Isabelle/HOL
design was (stream rat). That's about the best I have at the moment.

~~~
mafribe
BTW, in what sense is that coinductive? For what functor is it a final
coalgebra?

~~~
tel
Streams are coinductive, thus reals are the type of final coalgebras of (rat *
-) which satisfy the Cauchy condition. So something like (Sigma (mu (rat * -))
isCauchy).

~~~
mafribe
Don't you need to quotient after you've got Cauchy sequences? For example,
(0,0,0,0,....) is a representative of the same real number (as Cauchy
sequence) same as (1,0,0,0,0,0,....), but both are different as streams.

~~~
tel
Yeah, depends on how you're encoding it. Quotient types are to my knowledge
still tricky to implement, but you can try to make a setoid and structure this
type with some kind of equality. Of course, now we run directly into totality
and semi-decidability.

------
hudibras
Definitely stashing this away in my time machine for when I travel back to the
17th century. Make both Leibniz and Newton cry...

~~~
anon4
If you're taking things like that back in time, make sure to translate them to
French. Also, learn French. Not knowing French in the 17th century is like not
knowing English today.

~~~
ghshephard
Also, learn French in Canada, not France prior to your trip back in time. I've
been told that Canadians speak French like someone from the 1600s, and those
visitors (in 2015) from France find it archaic to the ear.

------
blahblah3
I remember the "concept" part of my high school calculus class. The teacher
had us recite out loud the epsilon-delta definition of continuity until
everybody memorized it so they could regurgitate it on the test.

I always wondered why analogies and pictures weren't used more often:

examples:

A 100m sprint is a continuous function of time (f(t) = distance from starting
line) because sprinters cant teleport. In fact it is uniformly continuous
because people have a maximum speed.

Beating usain bolt's record is a discontinuous function of completion time
because f(world_record + epsilon) = 0 while f(world_record - epsilon) = 1.

Fundamental theorem of calculus: If you want to know how fast a guy is running
at time t, look at how much ground he covered in 1 second. To get more and
more accurate, look at how far he traveled in 0.5 seconds and so on...

------
WallWextra
It was very DJB of him to use the gauge integral, which nobody else does.

------
murbard2
I was lucky enough that this is how I was taught calculus in high-school. It
definitely wasn't easy at the time, but I feel for all the students for whom
calculus is taught as a mindless set of algebraic rules.

This focus on _calculating_ derivatives as opposed to actually understanding
the concept and why the calculations work that way is, I think, why so many
struggle with it.

------
ww2
Definition 5.1/5.2 is interesting. It defines derivative at point c, not the
derivative function of f. Note that f1(x) is not equal to f'(x) for all x, but
f1(c) = f'(c).

~~~
bumbledraven
Yeah. The paper says: _The derivative of f at c is written f '(c). The
derivative of f, written f', is the function c -> f'(c)._

So the derivative (f') is the result of substituting c for x in f1. For
example, if f1 = (x -> x + c) then we would have f' = (c -> c + c) = (c ->
2c).

------
ww2
try to get the derivative of sin(x) from his approach.

~~~
bumbledraven
[http://math.stackexchange.com/questions/1303322/from-
carath%...](http://math.stackexchange.com/questions/1303322/from-
carath%C3%A9odory-derivative-definition-to-the-derivative-of-sinx)

------
anon4
One thing that bugs me about this, is that a lot of theorems seem to be
formulated backwards. To give an example:

Theorem 9.1. Let f be a continuous real-valued function. Let y be a real
number. Let b ≤ c be real numbers with f(b) ≤ y ≤ f(c). Then f(x) = y for some
x in [b, c].

Why is this well-formed? Once you say "Let y be a real number", I'm free to
pick any real number, which means that there might not be a b and c such that
f(b) ≤ y ≤ f(c). Now, I obviously understand what is said, but shouldn't this
be formulated more like:

Let f be a continuous real-valued function. Let b ≤ c be real numbers from the
domain of f. Let y be a real number in the closed interval bounded by f(b) and
f(c) ([f(b), f(c)] or [f(c), f(b)], depending on whether f(b) ≤ f(c) or not).
Then there exists an x in [b, c] such, that f(x) = y.

The way this and other theorems, definitions, etc. are formulated in the
article bugs me, because I must go back and re-qualify variables based on
information deduced from things introduced, after the variable in question was
introduced.

~~~
murbard2
The "let" should really be read as "for all". If you do so, your objection
disappears since quantifying over the empty always imply the consequent.

~~~
tel
You also need to translate "with" as a forall (pi binder) as well. Then,
you'll merely note that the formula is unsatisfiable without demonstrating a
proof that y is within the proper bounds.

~~~
eli_gottlieb
Oh _good_ , so I'm _not_ the only one whose mind tries to translate
mathematical prose into the notation of dependent type theory!

~~~
tel
Sometimes your problem really does just call for a hammer :)

