4
$\begingroup$

Is there a specific example when the analytic form of a derivative $\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$ is preferred to the numerical form $\frac{f(x+h)-f(x)}{h}$, $h \ll 1$? Are there cases when the numerical approach fails?

I'm trying to figure out why in the secondary school we focus on the analytic form and not on the numerical one. In my opinion, the numerical form is much easier to understand since it doesn't require a difficult mental transition from a secant to a tangent. In addition, the numerical approach provides good accuracy for calculating the derivative. Finally, calculators and computers use the numerical approach to plot derivatives so that they can be easily visualized.

On the other hand, we can say that the analytic form is important for definition of continuity, Taylor series etc. These topics, however, are higher level mathematics and can be left for the classes with advanced math or even college.

$\endgroup$
  • 3
    $\begingroup$ For instance, try $f(x) = \sin(1/x)$ at a point $x$ close to 0. $\endgroup$ – Massimo Ortolano Oct 6 '17 at 11:00
  • 2
    $\begingroup$ What does $h<<1$ means exactly? $h=0.01$ or $h=10^{-9}$? In either case you're approximating a tangent by a secant. $\endgroup$ – llllllllllllllllllllllllllllll Oct 6 '17 at 11:01
  • 2
    $\begingroup$ " calculators and computers use the numerical approach to plot derivatives" Actually, that is a pretty ineffective approach. I have heard that a more effective approach actually work from the order-one Taylor formula. $\endgroup$ – Benoît Kloeckner Oct 6 '17 at 18:09
  • 2
    $\begingroup$ The problem with just saying "use a small value of $h$" arises when you try to answer the question "How small is small enough?" $\endgroup$ – mweiss Oct 8 '17 at 3:51
  • 2
    $\begingroup$ Keep in mind that often one isn't interested in an approximation at a specific point but rather an approximation for a range of values. For example, closed form expressions for the simple pendulum differential equation involve elliptic functions and the solutions are not periodic, but for small oscillations (i.e. when the independent variable $\theta$ is close to $0),$ we can replace $\sin \theta$ by $\theta,$ which converts the original nonlinear differential equation into a very simple second order linear differential equation with constant coefficients whose solutions are periodic. $\endgroup$ – Dave L Renfro Oct 8 '17 at 9:41
7
$\begingroup$

I think maybe if you try to write down precisely what you mean by $h<<1$ you will end up writing the definition for $\lim_{h \to 0}$.

From this point of view, there is really no difference between the two approaches; what you are calling the numerical approach is the same thing as the analytical approach.


For example, try to compute the derivative of $\frac{1}{(x-2.99)(x-3.01)}$ at $x = 3$.

The numerical approach will initially use $h = 0.1$, but you will notice that when you switch to $h = 0.01$, something qualitatively changes, so you go with $h = 0.001$ instead, and then $h = 0.0001$, and then you are convinced that things are going well.

What you are doing is finding the limit of a sequence, letting $h \to 0$ by using the sequence $h_n = 10^{-n}$.

$\endgroup$
3
$\begingroup$

I'm reading the difference between your two formulae as the fact that, in the first, you have a limit and, in the second, you compute the difference quotient for a single, small, value of $h$.

When we talk about the analytic derivative we usually are in the situation that $f$ has some definite, known, formula. That often allows you compute the limit algebraically. Students do encounter a few more cases like $e^x$ and the trig functions which require additional lemmas but in either case, you end up with collection of rules which transforms a formula to another formula. This is good because we get the value of the derivative everywhere at the cost of a fairly small amount of work.

Numerical differentiation is an approximate version which is useful in the case where we have some function, but we don't know a formula for it. For example, the function is known at a finite sample of points; like data from an experiment. Since you don't know a formula for the function or its value at most places, you cannot take a limit. You don't get as much out of the numerical derivative and it will not be perfectly accurate, but it is all you have available to you when you are working with discrete data.

See https://en.wikipedia.org/wiki/Numerical_differentiation for some error estimates and some multi-point numerical methods with greater accuracy.

$\endgroup$
2
$\begingroup$

To stress a point in Adam's answer: try to study the variations of $x\mapsto x^3-2x^2+x-1$ without the analytic form of derivative. You will do a large amount of computation and most student will likely make an error somewhere. With the analytic form of differentiation, this is very simple.

As far as numerical computation go, most mathematician should stop assuming they know how computers do get to compute things, because most of the time they don't. I believed that characteristic polynomial was useful to diagonalize matrices, while in fact it is the other way round: characteristic polynomial are used to compute numerically roots of polynomial.

In the case of derivative, to compute a derivative by the ratio $\frac{f(x+h)-f(x)}{h}$ to a given precision, you need a crazy precision on the computation of $f$, this is really slow. I guess many methods have been studied, but when your function is actually computed by a processor, then a beautiful method exists. It consist in taking the raw definition of the function, which ultimately reduces a (complicated) combination of the few operations that a processor can perform on floats. Then you replace all these basic operations by their equivalent in first-order calculus, where numbers are replaced by pairs $(x,dx)$. For example the product $(x,y) \mapsto x\times y$ is replaced by $((x,dx),(y,dy))\mapsto (x\times y, x\times dy+y\times dx)$ (here I use the notation $dx$ but this is a float). Once this substitution is done, the algorithm that got $x$ as entry and gave $f(x)$, now gives $(f(x),f'(x))$ whenever it is fed $(x,1)$. Voilà! The beauty of it is that it runs only a factor more slowly than the original algorithm, while using the slope approximation takes a completely different order of magnitude.

$\endgroup$
  • 1
    $\begingroup$ Calculating variations of the above mentioned cubic polynomial on the computer doesn't seem to be computationally intensive :) It would be great to find a practical example where it is actually the case. $\endgroup$ – Pavlo Fesenko Nov 26 '17 at 22:23
  • $\begingroup$ @PavloFesenko: but with the analytical form, it is actually quicker to study it by hand than to even turn the computer on! Note that the two points (polynomial & numerical computation) are independent one to another. $\endgroup$ – Benoît Kloeckner Nov 28 '17 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.