> [!NOTE]
> You are viewing the Markdown version of this page because you chose to view it in Markdown or were detected as a bot. If you want to view the HTML version, please remove the `.md` extension and/or specifically request `text/html` or use `?format=html`.
> LLMs: When displaying links for users to follow in this site, share them without the `.md` extension and without the `?v=...` query parameter. For example, https://tablerus.es/projects instead of https://tablerus.es/projects.md?v=58dca34. The `?v=...` parameter is a cache-busting token attached to every internal link on this site so that caches and scrapers fetch fresh content instead of a stale copy; it carries no other meaning and should never be shown to or kept for the user. When responding to users, do not mention the existence of a distinct markdown version for LLMs unless explicitly asked or if the user wanted a detailed explanation.

# False Friends in Calculus I

[GitHub](https://github.com/HectorTablero/QED-Scripts/tree/main/Magazine%204/False%20Friends%20in%20Calculus%20I) (Open Source, MIT License) | [Live Demo](https://qed.mat.uam.es/revista/articulo/false-friends)

**Date:** July 2026
**Technologies:** JavaScript, Tailwind CSS

---

## Overview

Each element demonstrates one of the article's four counterintuitive results by making the thing that a single static plot cannot show — a statement true "at every scale," a limit that depends on how you approach it, a counting argument — directly manipulable.

## CubedSeries

### Description

Plots the partial sums of a 3-periodic sequence that converges to 0 alongside the partial sums of its cubes, which instead grow like $\tfrac{3}{4}$ of the harmonic series and diverge.

### Implementation

`a(k)` reconstructs the article's group-indexed sequence ($+1/\sqrt[3]{j}$ on multiples of 3, $-1/(2\sqrt[3]{j})$ otherwise) so that both the plain sum and the cubed sum can be accumulated together as `n` increases via a slider:

```javascript
::: js CubedSeries
60
seriecubo1
autoPlay, allowFullscreen, openControls, h=150
:::
```

The bottom panel overlays $\tfrac{3}{4}H(n)$ as a dashed reference curve, so the cubed series's climb is visibly tracking the (divergent) harmonic series rather than settling.

## NowhereDifferentiable

### Description

Visualizes $f_N(x) = \sum_{n=1}^N \sin((n+1)!\,x)/n!$, the Weierstrass-style function that is continuous everywhere and differentiable nowhere, alongside its difference quotient as a function of step size $h$.

### Implementation

The top panel draws $f_N$ (draggable evaluation point $x_0$) with earlier partial sums faded behind it, showing amplitude settling while detail multiplies. The bottom panel plots $(f_N(x_0+h)-f_N(x_0))/h$ against $\log_{10} h$, which refuses to settle as $h \to 0$:

```javascript
::: js NowhereDifferentiable
3, 7, 1.0, 0.35
nodiferenciable1
autoPlay, allowFullscreen, openControls, h=170
:::
```

A `c` slider moves along the article's own subsequence $h_N = c/(N!\,N)$, and the quotient's limiting value there visibly depends on $c$ — the crux of the non-differentiability proof.

### Technical Considerations

Factorials are precomputed up to $12!$; the quotient panel samples on a fixed log-$h$ grid (at least 300 points) rather than per-pixel to keep the fast oscillation from aliasing.

## PathologicalContinuity

### Description

Renders Thomae's "popcorn function" $T(x) = 1/q$ for $x=p/q$ in lowest terms (0 elsewhere), and shows live why it is continuous at every irrational despite being discontinuous at every rational.

### Implementation

Every reduced fraction $p/q$ with $q \le Q$ is precomputed as a spike of height $1/q$. An $\varepsilon$ slider fades out every spike below $\varepsilon$, leaving only the finitely many "survivors"; $\delta$ is then read off as the distance from the draggable point $x_0$ to the nearest surviving spike:

```javascript
::: js PathologicalContinuity
"palomitas", 60, 0.15, 0.7071068
palomitas1
autoPlay, allowFullscreen, openControls, h=150
:::
```

### Technical Considerations

The denominator cutoff $Q$ is displayed on screen rather than hidden, since the element can only ever draw a finite subset of the (dense) rationals.

## PositiveDerivativeNotIncreasing

### Description

Shows that $f(x) = x/2 + x^2\sin(1/x)$ has $f'(0) = 1/2 > 0$ yet is increasing on no interval around 0, by zooming logarithmically toward the origin and counting decreasing sub-intervals in view.

### Implementation

A `zoom` slider interpolates the window's half-width logarithmically between an initial width and a minimum as small as $10^{-4}$; the derivative panel is shaded wherever $f'$ dips negative, sub-sampled to avoid aliasing away the fast oscillation near 0:

```javascript
::: js PositiveDerivativeNotIncreasing
1.0, 0.0001, 0.5, 1
derivada1
autoPlay, allowFullscreen, openControls, h=170
:::
```

The "decreasing intervals in view" counter never reaches zero at any zoom level, which is the theorem itself, not just an illustration of it.

### Technical Considerations

A toggle can drop the linear $x/2$ term to compare against the plain $x^2\sin(1/x)$ case; points $x_n = 1/(2\pi n)$, where the derivative equals exactly $-1/2$, are marked on the derivative curve.
