Free Online Utility • MATH Studio • Exact BigInt Engine

Draw Thomae Function

Draw Thomae's Popcorn Function (f(p/q) = 1/q for reduced rationals, 0 for irrationals)—continuous at every irrational number, discontinuous at every rational number, and Riemann integrable with integral 0.

Formula & Quick Reference Live Canvas
f(x) = 1 / q   if x = p/q in lowest terms (gcd(p,q)=1, q > 0)
f(x) = 0       if x is irrational   |   ∫₀¹ f(x) dx = 0
IrrationalsContinuous
RationalsDiscontinuous
Integral∫₀¹ f(x)dx = 0
POPCORN / STARS OVER BABYLON FUNCTION
Draw Thomae Function
Interactive Mathematical Visualization Engine Instant

Session Calculation Log

No entries recorded in this session yet.

Complete Technical Guide to Draw Thomae Function

Also called the Ruler Function or Stars Over Babylon, Thomae's function is a crown jewel of real analysis counterexamples.

Rendered natively on a High-DPI HTML5 Canvas with real-time parameter sliders, live mathematical metrics, and instant PNG export.

Thomae's Popcorn Definition (1875)

f(x) = 1 / q   if x = p/q in lowest terms (gcd(p,q)=1, q > 0)
f(x) = 0       if x is irrational   |   ∫₀¹ f(x) dx = 0

Because only finitely many reduced fractions have 1/q > ε, the function approaches 0 around every irrational point (making it continuous at all irrationals!).

How to Use Draw Thomae Function

  1. 1Adjust parameters with the sliders or inputs to update the curve in real time.
  2. 2Switch color themes between Rainbow, Plasma, Emerald, and Cyan.
  3. 3Click Download PNG to save high-contrast mathematical diagrams.

Reference Examples & Worked Benchmarks

PropertyValue / FormulaNotes
IrrationalsContinuousLimit = 0 everywhere
RationalsDiscontinuousJump of height 1/q
Integral∫₀¹ f(x)dx = 0Riemann integrable

Practical Applications & Engineering Workflows

Mathematics & Physics Visualization

Explore the exact geometry and convergence behavior of Thomae Function.

Publication & Classroom Figures

Export crisp dark-mode PNG plots ready for slides and notes.

Accuracy, Edge Cases & Best Practices

  • Computed 100% client-side with zero external dependencies.

All calculations execute locally inside your browser using JavaScript with zero server round-trips, guaranteeing instant responsiveness and complete data privacy.

Frequently Asked Questions

How can Thomae's function be continuous at every irrational number?
For any ε > 0, only finitely many rationals satisfy 1/q ≥ ε, so a small enough neighborhood around any irrational x keeps f(t) < ε.
Why is its Riemann integral equal to 0?
The set of discontinuities (ℚ) is countable and has Lebesgue measure zero.