How Math Notes Variable Sliders Work in iOS 18

Apple’s Math Notes in iOS 18 introduces interactive numerical sliders that adjust variables and update mathematical expressions instantaneously. This article explores the underlying technical architecture enabling this real-time performance, including on-device parsing, reactive dependency graphs, lightweight evaluation engines, and tight integration with the Apple Silicon hardware pipeline.

On-Device Parsing and Expression Trees

When you write or type a mathematical expression in Math Notes, the system uses machine learning models via the Neural Engine to perform optical character recognition (OCR) and mathematical symbol recognition. Once converted to digital input, the equation is converted into an Abstract Syntax Tree (AST).

The AST breaks down complex mathematical statements into hierarchical relationships between operands, operators, functions, and variables. By converting user input into an AST once, the system avoids re-parsing handwriting or text each time a value shifts.

Reactive Dependency Graphs

To handle multi-variable relationships and chained calculations, Math Notes maintains an in-memory Directed Acyclic Graph (DAG) of the document:

  • Variable Nodes: Standalone values, such as x = 5.
  • Expression Nodes: Equations dependent on one or more variables, such as y = 2x + 10.

When you activate a slider on a number, iOS 18 marks that value as a dynamic input node. As your finger drags the slider, only the downstream branches of the DAG that depend directly or indirectly on that specific variable are flagged for re-evaluation. Non-dependent calculations remain cached, saving computational overhead.

Delta-Driven Dynamic Evaluation

Instead of compiling the entire document into machine code or running a heavy symbolic algebra suite, Math Notes uses a lightweight, optimized numerical evaluation engine.

When you drag a slider:

  1. Touch events emit high-frequency floating-point updates.
  2. The engine injects the new float directly into the memory address of the targeted variable.
  3. The evaluation engine traverses the dependency graph, executing only the simple arithmetic or algebraic operations required to resolve the affected outputs.
  4. Intermediate algebraic expressions are evaluated as standard floating-point operations directly on the CPU, completing in fractions of a microsecond.

120Hz UI and Metal Rendering Pipeline

Achieving a visually instantaneous response requires zero display lag. Math Notes coordinates evaluation cycles with the device's display refresh rate (up to 120Hz on ProMotion displays).

  • Direct Touch-to-Render Loop: Touch events from the display digitizer update the underlying float variable, trigger the graph evaluation, and output the computed string or graph plot within the same frame cycle (typically under 8.3 milliseconds).
  • Vector Graph Rendering: If the slider manipulates an equation linked to an interactive coordinate plane, the plotting points are recalculated and rendered via Metal-accelerated shaders, updating plotted lines smoothly without frame drops.

Because the entire process—from handwriting interpretation to dependency resolution and floating-point computation—is executed locally on Apple Silicon, there is zero network latency, resulting in an immediate and fluid calculation experience.