1 | initial version |

You can proceed as follows, where $N$ is given to serve as an approximation of $\infty$.

```
sage: g(x) = abs(x - floor(x) - 1/2)
sage: def f(x, N): return sum(g(2^j*x)/2^j for j in range(N+1))
sage: N = 100 # for instance...
sage: plot(f(x, N), x, -1, 1)
```

**Note.** For this approach to make sense, you need to show that that the partial sums converge fast, which is the case since $g(x) \le 1/2$ for all $x$.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.