# Weierstrass function

(Redirected from Continuous, nowhere differentiable function)
Plot of Weierstrass function over the interval [−2, 2]. Like fractals, the function exhibits self-similarity: every zoom (red circle) is similar to the global plot.

In mathematics, the Weierstrass function is an example of a pathological real-valued function on the real line. The function has the property of being continuous everywhere but differentiable nowhere. It is named after its discoverer Karl Weierstrass.

Historically, the Weierstrass function is important because it was the first published example (1872) to challenge the notion that every continuous function was differentiable except on a set of isolated points.[1]

## ConstructionEdit

Animation based on the increasing of the b value from 0.1 to 5.

In Weierstrass's original paper, the function was defined as the sum of a Fourier series:

${\displaystyle f(x)=\sum _{n=0}^{\infty }a^{n}\cos(b^{n}\pi x),}$

where ${\displaystyle 0 , ${\displaystyle b}$  is a positive odd integer, and

${\displaystyle ab>1+{\frac {3}{2}}\pi .}$

The minimum value of ${\displaystyle b}$  which satisfies these constraints is ${\displaystyle b=7}$ . This construction, along with the proof that the function is nowhere differentiable, was first given by Weierstrass in a paper presented to the Königliche Akademie der Wissenschaften on 18 July 1872.[2][3][4]

Despite never being differentiable, the function is continuous: Since the terms of the infinite series which defines it are bounded by ±an and this has finite sum for 0 < a < 1, convergence of the sum of the terms is uniform by the Weierstrass M-test with Mn = an. Since each partial sum is continuous, by the uniform limit theorem, it follows that f is continuous. Additionally, since each partial sum is uniformly continuous, it follows that f is also uniformly continuous.

Naïvely it might be expected that a continuous function must have a derivative, or that the set of points where it is not differentiable should be "small" in some sense. According to Weierstrass in his paper, earlier mathematicians including Gauss had often assumed that this was true. This might be because it is difficult to draw or visualise a continuous function whose set of nondifferentiable points is something other than a countable set of points. Analogous results for better behaved classes of continuous functions do exist, for example the Lipschitz functions, whose set of non-differentiability points must be a Lebesgue null set (Rademacher's theorem). When we try to draw a general continuous function, we usually draw the graph of a function which is Lipschitz or otherwise well-behaved.

The Weierstrass function could perhaps be described as one of the very first fractals studied, although this term was not used until much later. The function has detail at every level, so zooming in on a piece of the curve does not show it getting progressively closer and closer to a straight line. Rather between any two points no matter how close, the function will not be monotone. The Hausdorff dimension D of the graph of the classical Weierstrass function is bounded above by 2 + logba, (where a and b are the constants in the construction above) and is generally believed to be exactly that value, but this has not been proven rigorously.[5][6] Notice that 1 < D < 2 if ab > 1.

The term Weierstrass function is often used in real analysis to refer to any function with similar properties and construction to Weierstrass's original example. For example, the cosine function can be replaced in the infinite series by a piecewise linear "zigzag" function. G. H. Hardy showed that the function of the above construction is nowhere differentiable with the assumptions 0 < a < 1, ab ≥ 1.[7]

## Hölder continuityEdit

It is convenient to write the Weierstrass function equivalently as

${\displaystyle W_{\alpha }(x)=\sum _{n=0}^{\infty }b^{-n\alpha }\cos(b^{n}\pi x)}$

for ${\displaystyle \alpha =-\ln(a)/\ln(b)}$ . Then Wα(x) is Hölder continuous of exponent α, which is to say that there is a constant C such that

${\displaystyle |W_{\alpha }(x)-W_{\alpha }(y)|\leq C|x-y|^{\alpha }}$

for all x and y.[8] Moreover, Wα is Hölder continuous of all orders α < 1 but not Lipschitz continuous.

## Density of nowhere-differentiable functionsEdit

It turns out that the Weierstrass function is far from being an isolated example: although it is "pathological", it is also "typical" of continuous functions:

• In a topological sense: the set of nowhere-differentiable real-valued functions on [0, 1] is comeager in the vector space C([0, 1]; R) of all continuous real-valued functions on [0, 1] with the topology of uniform convergence.[9][10]
• In a measure-theoretic sense: when the space C([0, 1]; R) is equipped with classical Wiener measure γ, the collection of functions that are differentiable at even a single point of [0, 1] has γ-measure zero. The same is true even if one takes finite-dimensional "slices" of C([0, 1]; R), in the sense that the nowhere-differentiable functions form a prevalent subset of C([0, 1]; R).

## Python Code ExampleEdit

The following sample code is offered to describe how the above animation might have been constructed. Note that it is indeed the parameter 'b' which is being varied. So in the initial iterations, the curve is both continuous and differentiable. It is not until the latest iterations that the criteria about ${\displaystyle b>=7}$  and ${\displaystyle ab>1+\pi *3/2}$  are approached, and the curve being displayed truly becomes the Weierstrass function. The behaviour of the animation is very dependent on the exact value of 'a' used.

#! /usr/bin/env python3
# weierstrass.py

import numpy as np
import matplotlib.pyplot as pl
import matplotlib.animation as anim

fig, ax = pl.subplots()

# min/max extents for xy plot
xmin = -2.5
xmax =  2.5
ymin = -4
ymax =  4

xnum = 500  # number of data points in the xdat array

# given the x-values in array xdata,
# this function computes the corresponding y-values
# for the 'i'th frame
def weierstrass (xdata,i):
a = .7
b = 0.025 * i
# create array of zeros, same length as xdata
ydata = np.zeros(xdata.shape[0])
# only compute first 30 terms of infinite series (approximate)
for n in range(30):
tdata =  (b**n) * np.pi * xdata
ydata += (a**n) * np.cos(tdata)
return ydata

# this function is call at each frame
# to compute the new data
def update (i):
line.set_ydata(weierstrass(xdat,i))
return line,

# compute the original x-values to be evaluated.
xdat = np.arange(xmin, xmax, (xmax-xmin)/xnum)

# add the x and f(x) data to the plot
line, = ax.plot(xdat, weierstrass(xdat,0), 'b-', lw=1)

pl.title('Development of Weierstrass Function')
pl.xlabel('x')
pl.ylabel('f(x)')
pl.xlim(xmin,xmax)
pl.ylim(ymin,ymax)
pl.grid()

# setup the animation
ani = anim.FuncAnimation(fig,               # target plot
update,             # callback function
np.arange(1, 300),  # range of values 'i' for callback
interval=100,       # framePeriod in milliseconds
blit=True)
pl.show()


## NotesEdit

1. ^ At least two researchers formulated continuous, nowhere differentiable functions before Weierstrass, but their findings were not published in their lifetimes. Around 1831, Bernard Bolzano (1781 - 1848), a Czech mathematician, philosopher, and Catholic priest, constructed such a function; however, it was not published until 1922. See:
• Martin Jašek (1922) "Funkce Bolzanova" (Bolzano's function), Časopis pro Pěstování Matematiky a Fyziky (Journal for the Cultivation of Mathematics and Physics), vol. 51, no. 2, pages 69 - 76 (in Czech and German).
• Vojtěch Jarník (1922) "O funkci Bolzanově" (On Bolzano's function), Časopis pro Pěstování Matematiky a Fyziky (Journal for the Cultivation of Mathematics and Physics), vol. 51, no. 4, pages 248 - 264 (in Czech). Available on-line in Czech at: http://dml.cz/bitstream/handle/10338.dmlcz/109021/CasPestMatFys_051-1922-4_5.pdf . Available on-line in English at: http://dml.cz/bitstream/handle/10338.dmlcz/400073/Bolzano_15-1981-1_6.pdf .
• Karel Rychlík (1923) "Über eine Funktion aus Bolzanos handschriftlichem Nachlasse" (On a function from Bolzano's literary remains in manuscript), Sitzungsberichte der königlichen Böhmischen Gesellschaft der Wissenschaften (Prag) (Proceedings of the Royal Bohemian Society of Philosophy in Prague) (for the years 1921-1922), Class II, no. 4, pages 1-20. (Sitzungsberichte was continued as: Věstník Královské české společnosti nauk, třída matematicko-přírodovědecká (Journal of the Royal Czech Society of Science, Mathematics and Natural Sciences Class).)
Around 1860, Charles Cellérier (1818 - 1889), a professor of mathematics, mechanics, astronomy, and physical geography at the University of Geneva, Switzerland, independently formulated a continuous, nowhere differentiable function that closely resembles Weierstrass's function. Cellérier's discovery was, however, published posthumously:
2. ^ On page 560 of the 1872 Monatsberichte der Königlich Preussischen Akademie der Wissenschaften zu Berlin (Monthly Reports of the Royal Prussian Academy of Science in Berlin), there is a brief mention that on July 18th, "Hr. Weierstrass las über stetige Funktionen ohne bestimmte Differentialquotienten" (Mr. Weierstrass read [a paper] about continuous functions without definite [i.e., well-defined] derivatives [to members of the Academy]). However, Weierstrass's paper was not published in the Monatsberichte.
3. ^ Karl Weierstrass, "Über continuirliche Functionen eines reellen Arguments, die für keinen Werth des letzeren einen bestimmten Differentialquotienten besitzen," (On continuous functions of a real argument which possess a definite derivative for no value of the argument) in: Königlich Preussichen Akademie der Wissenschaften, Mathematische Werke von Karl Weierstrass (Berlin, Germany: Mayer & Mueller, 1895), vol. 2, pages 71–74.;
4. ^ See also: Karl Weierstrass, Abhandlungen aus der Functionenlehre [Treatises from the Theory of Functions] (Berlin, Germany: Julius Springer, 1886), page 97.
5. ^ Kenneth Falconer,The Geometry of Fractal Sets (Cambridge, England: Cambridge University Press, 1985), pages 114, 149.
6. ^ See also: Brian R. Hunt (1998) "The Hausdorff dimension of graphs of Weierstrass functions," Proceedings of the American Mathematical Society, vol. 126, no. 3, pages 791-800.
7. ^ Hardy G. H. (1916) "Weierstrass's nondifferentiable function," Transactions of the American Mathematical Society, vol. 17, pages 301–325.
8. ^ Zygmund, A. (2002) [1935], Trigonometric series. Vol. I, II, Cambridge Mathematical Library (3rd ed.), Cambridge University Press, ISBN 978-0-521-89053-3, MR 1963498, p. 47.
9. ^ Mazurkiewicz, S.. (1931). "Sur les fonctions non dérivables". Studia. Math. (3): 92–94.
10. ^ Banach, S. (1931). "Über die Baire'sche Kategorie gewisser Funktionenmengen". Studia. Math. (3): 174–179.

## ReferencesEdit

• B.R. Gelbaum and J.M.H. Olmstead, Counterexamples in Analysis, Holden Day Publisher (June 1964).
• Karl Weierstrass, "Über continuirliche Functionen eines reellen Arguments, die für keinen Werth des letzeren einen bestimmten Differentialquotienten besitzen," in: Königlich Preussichen Akademie der Wissenschaften, Mathematische Werke von Karl Weierstrass (Berlin, Germany: Mayer & Mueller, 1895), vol. 2, pages 71–74.; English translation: On continuous functions of a real argument that do not possess a well-defined derivative for any value of their argument, in: G.A. Edgar, Classics on Fractals, Addison-Wesley Publishing Company, 1993, 3–9.
• G.H. Hardy, "Weierstrass's nondifferentiable function," Trans. Amer. Math. Soc., 17(1916), 301–325.
• K. Falconer, The Geometry of Fractal Sets, Oxford (1984).