# Takagi–Landsberg curve

The blancmange function is defined on the unit interval by

${\rm blanc}(x) = \sum_{n=0}^\infty {s(2^{n}x)\over 2^n},$

where $s(x)$ is defined by $s(x)=\min_{n\in{\bold Z}}|x-n|$, that is, $s(x)$ is the distance from x to the nearest integer. The infinite sum defining $blanc(x)$ converges absolutely for all x, but the resulting curve is a fractal. The blancmange function is continuous but nowhere differentiable.

The Takagi–Landsberg curve is a slight generalization, given by

$T_w(x) = \sum_{n=0}^\infty w^n s(2^{n}x)$

for a parameter w; thus the blancmange curve is the case $w = 1 / 2$. For $w = 1 / 4$, one obtains the parabola: the construction of the parabola by midpoint subdivision was described by Archimedes.

### The JavaScript code to produce this picture

 var bd = JXG.JSXGraph.initBoard('box', {axis:true,boundingbox: [-0.05, 16, 1.27, -4]});
var w = bd.create('slider', [[0,8],[0.8,8],[0,0.25,1.5]], {name:'w'});
var N = bd.create('slider', [[0,7],[0.8,7],[0,5,40]], {name:'N'});
var s = function(x){ return Math.abs(x-Math.round(x)); };
var c = bd.create('functiongraph', [
function(x){
var n, su, wval;
su = 0.0;
wval = w.Value();
for (n=0;n<N.Value();n++) {
su += Math.pow(wval,n)*s(Math.pow(2,n)*x);
}
return su;
},0,1],{strokeColor:'red'});