# Is this elementary, nilpotent-free approach to automatic differentiation strong enough for real analysis? How similar is it to Newton's system?

The ring of "dual numbers" is of the form $$a+b\,dx$$, where $$dx$$ is an "infinitesimal" quantity that squares to 0; they can be constructed pretty simply as the quotient of the polynomial ring $$\Bbb R[dx]/dx^2$$. These are interesting for their use in automatic differentiation, and because they form a minimalist structure that is sufficient for a good portion of calculus, and have even been used to teach high school calculus. They also share some superficial similarity with Newton's approach in neglecting the square of an infinitesimal.

In general, the useful thing about the dual numbers is that for any analytic function $$f$$ that we want to evaluate at some $$r$$, we have

$$f(r+dx) = f(r) + f'(r) dx$$

The main issue people mentioned about them in my original thread is that they don't form a field, causing some issues. In particular, $$dx^2=0$$ can cause some pitfalls in defining higher derivatives, as pointed out by Terry Tao in the above blog post. Higher-order nilpotents have sometimes been suggested to gain an incremental improvement. If we instead had $$dx^3=0$$, for instance, working through the algebra we would get the following result:

$$\displaystyle f(r+dx) = f(r) + f'(r) dx + \frac{f''(r)}{2!} dx^2$$

We can continue on this way, with $$dx^4=0$$ and so on, to get increasingly large polynomials in $$dx$$ with higher derivatives, all of which can be useful in automatic differentiation.

As we continue to increase the degree of $$dx^n=0$$, so that it becomes a nilpotent of "infinite degree," going through the algebra we see we get an expansion into derivatives of all orders:

$$\displaystyle f(r+dx) = f(r) + f'(r) dx + \frac{f''(r)}{2!} dx^2 + \frac{f'''(r)}{3!} dx^3 + ...$$

of which the nilpotent versions are just truncations at some finite $$dx^n$$.

The strange thing is, though, this isn't just some kind of "theoretically perfect" automatic differentiation scheme -- now that we have dropped nilpotents, we have literally just rediscovered Taylor's theorem in an interesting symbolic setting, evaluated on the function $$f(x+dx)$$ at the point $$x=r$$. We no longer need to treat $$dx$$ as an object in a special new ring at all - we can literally just make it an indeterminate real number. As a result, we have all the desirable qualities of a field, a perfect "transfer principle", and about as elementary a treatment as you could want.

All you need to do is literally just add a symbolic indeterminate real variable $$dx$$, proceed in the manner of the usual automatic differentiation to as high a degree of $$dx^n$$ as desired, and then just pluck off the coefficient of that $$dx^n$$ term and multiply by $$n!$$ to get the $$n$$th derivative.

My questions:

1. This seems to be so basic that it's almost surprising that it works so well. By getting rid of nilpotents and just using a single indeterminate real number, it behaves the same as a "nilpotent of infinite order" when doing algebraic automatic differentiation, and we get a more powerful theory that is also more basic, with all the properties of a field and certainly a "transfer principle." Is there some drawback I'm not seeing?
2. Is there some benefit to are there to using nonstandard analysis and ultrafilters rather than the above method, given that both have a "transfer principle?"
3. What benefits are there to using smooth infinitesimal analysis rather than the above method?
4. Is this in any way similar to how Newton used "fluxions," historically? Or similar to Leibniz's infinitesimal approach?

EDIT: one caveat I originally noticed is that the above may only work for "sufficiently small" $$dx$$, due to convergence issues. Originally, I had suggested one way to avoid this is to return to the notion of extending the reals with a new purely formal quantity $$dx$$, as with dual numbers, but which is not nilpotent. The polynomial ring $$\Bbb R[dx]$$ won't work as we have an infinite sum of powers of $$dx$$, so I suggested the formal power series ring $$\Bbb R[[dx]]$$ or the formal Laurent series ring $$\Bbb R((dx))$$. However, as mentioned below, this may be more trouble than it's worth, and can cause its own problems: we no longer have a "transfer principle," $$\exp(-dx)$$ is not defined, etc, although it is certainly interesting. However, it seems that it may not be necessary - convergence shouldn't be an issue when proceeding purely symbolically with the automatic differentiation to as high a degree of $$dx$$ as is desired.

• It would be clearer to say that your $x$ is a given real number, and maybe denote it $r$. Notice that your equality $\overline{f}(r+d x)=...$ is a definition of a natural extension of the analytic function $f$ to a subset of the ring of finite elements in the field of Laurent series. It requires some work to extend it to that whole ring, which maybe makes the approach with nilpotent infinitesimals simpler, especially to teach calculus. However I don't really understand what this does in the way of teaching calculus. – nombre Apr 26 '19 at 9:21

I think you need to think more about what this is meant to achieve. Also, you are considering two different rings, and it is important to avoid equivocating between them - formal power series have some nice properties that formal Laurent series do not have, like being closed under $$\exp.$$ Anyway, here is a partial answer to 1 or 4.
In nonstandard analysis $$\epsilon$$ is a real number. In $$\mathbb R((dx)),$$ you don't have $$|dx|,$$ or $$\sqrt{|dx|},$$ or $$\exp(dx^{-1}).$$
• You make a good point. The original thought was, if you just let $dx$ be another real variable, for any polynomial $p$ you can evaluate $p(x+dx)$ to get the expansion I mentioned, which extends to analytic functions in the same way that dual numbers do. I first thought "adding a real variable" would be the same as using the polynomial ring $R[dx]$, but it isn't because we have an infinite sum of $dx$'s, so I thought formal power series or formal Laurent series would be what it is. But perhaps it isn't any of these things. What would it be? – Mike Battaglia Apr 26 '19 at 15:48
• I may edit this question since "just add a new real variable $dx$" was the main thought, and the Laurent series thing just a tangent. – Mike Battaglia Apr 26 '19 at 15:50