Physics Tools

Physics Tools

Interactive demos and calculators for exploring physics and mathematics. These tools make abstract concepts tangible and demonstrate how we turn theoretical ideas into working code.


Overview

Physics and mathematics are the foundation of computing. These tools help us:

Each tool is designed to be:


Available Tools

Boolean Function Solver

Interactive Truth Table Explorer

A comprehensive React-based tool for exploring all 16 two-input boolean functions and their properties. Originally developed as part of a conversation about boolean algebra and digital logic.

Key Features:

Use Cases:


The Boolean Solver Story

The Boolean Function Solver was created during an extended conversation exploring the foundations of computing. It started with a simple question: “How do we visualize all possible 2-input boolean functions?”

What emerged was a complete mathematical framework for understanding boolean logic:

  1. Truth Tables as Geometry — Each function is a 2×2 grid pattern
  2. Visual Representation — Shaded cells represent TRUE outputs
  3. Mathematical Analysis — Walsh-Hadamard coefficients reveal spectral properties
  4. Information Theory — Shannon entropy quantifies information content
  5. Circuit Synthesis — Automatic NAND gate network generation

The tool demonstrates how pure mathematics can be turned into interactive software that’s both useful and educational.


Mathematical Foundations

Boolean Algebra Basics

A boolean function with n inputs has 2^n possible input combinations, and therefore 2^(2^n) possible functions.

For n=2:

Walsh-Hadamard Transform

The Walsh-Hadamard transform is the boolean analog of the Fourier transform. It decomposes a boolean function into its spectral components:

c0 = average value
c1 = coefficient for input A
c2 = coefficient for input B  
c12 = coefficient for interaction A×B

These coefficients reveal:

Shannon Entropy

Measures the information content of a boolean function:

H = -Σ p(x) log2 p(x)

Where p(x) is the probability of each output value.


Architecture

The Boolean Solver uses a React-based architecture with:

  1. State Management — Truth table state in React hooks
  2. Real Math — Pure JavaScript implementations of mathematical operations
  3. Real-time Calculation — All solvers run on every state change
  4. Responsive Design — Works on desktop and mobile
  5. Visual Feedback — Clear, color-coded representations

Code Structure

BooleanSolver (Component)
├── State: tableIndex (current truth table)
├── Handlers: toggleCell (edit truth table)
├── Calculations:
│   ├── computeWalsh (Fourier coefficients)
│   ├── shannonSplit (information analysis)
│   └── synthesizeNand (circuit synthesis)
└── Render:
    ├── Truth table editor
    ├── Gate selector
    ├── Walsh coefficients
    ├── Shannon analysis
    └── Circuit synthesis

Usage Examples

Example 1: Understanding XOR

  1. Click the cells for XOR pattern: (0,1)=1, (1,0)=1
  2. See it identified as “XOR (differ)”
  3. View Walsh coefficients showing non-linearity
  4. See NAND synthesis: XOR = NAND(NAND(x1,x2), NAND(x1,x1), NAND(x2,x2))

Example 2: Finding Equivalent Functions

  1. Click random cells to create a function
  2. Note the gate name
  3. Click “XOR” preset
  4. Compare Walsh coefficients — different functions can have similar spectral properties

Example 3: Circuit Design

  1. Select “AND” function
  2. See minimal NAND synthesis: AND = NAND(NAND(x1,x2), NAND(x1,x2))
  3. Depth: 2 (two levels of NAND gates)

Performance


Educational Value

This tool demonstrates:

  1. Boolean Algebra — All 16 functions and their relationships
  2. Digital Logic — How gates combine to create circuits
  3. Information Theory — Shannon entropy and information content
  4. Fourier Analysis — Boolean analog of signal processing
  5. Universal Computation — NAND is universal (can implement any function)
  6. Algorithmic Thinking — Solvers that find optimal solutions

Source Code

The complete source is available from the conversation archive:

View in conversation archive (archive/source/boolean-solver.jsx)

Or download:

# Extract from conversation archive
unzip /opt/aurora/work/conversation-archive.zip archive/source/boolean-solver.jsx

# Or view other related files
unzip /opt/aurora/work/conversation-archive.zip archive/source/ultimate-solver.jsx
unzip /opt/aurora/work/conversation-archive.zip archive/docs/01-boolean-truth-tables.md


Mathematics is the language of the universe. Code is how we make it speak.

Boolean Solver - Interactive Truth Table Explorer

Boolean Solver

Interactive Truth Table Explorer with Walsh-Hadamard Transform, Shannon Split, and NAND Circuit Synthesis

Explore all boolean functions interactively — complete for n=0,1,2,3, including the trivial cases. Click cells to build any truth table and watch three live solvers analyze your function in real-time.


Overview

The Boolean Solver is an interactive React + Three.js tool that transforms abstract boolean algebra into a tangible, visual experience. It enables you to explore all possible boolean functions for n=0 through n=3 inputs (1, 4, 16, and 256 functions respectively) through direct manipulation of truth tables.

Read more...