Method notes

Inverse search with a scientific RPN calculator

The calculator reverses the usual numerical workflow. Instead of entering a formula and obtaining a number, one enters a number and searches for short calculator programs that reproduce it.

Workflow

Use the tool the way one uses a numerical experiment: record the input, the assumptions, the search parameters, and the candidate expression. The result is not a proof.

  1. 1

    Choose a numerical target z

    Use a value produced by a calculation, measurement, integral, sum, simulation, or exercise. Do not supply more digits than are meaningful.

  2. 2

    Set the uncertainty

    When z is known only approximately, give an error estimate. Exact-looking decimal input can otherwise produce misleading overfitted formulas.

  3. 3

    Set maximum code length K

    K bounds the length of the RPN button sequence. Each additional step increases the search space roughly by the calculator alphabet size.

  4. 4

    Verify candidates outside the search

    A returned expression is a numerical lead. Recompute at higher precision or prove the identity from the original mathematical problem.

RPN model

The search space is defined by a standard scientific RPN calculator. Button sequences are encoded as integer codes, then evaluated one after another. The original browser version describes this as a virtual calculator whose buttons are pressed sequentially by CPUs rather than randomly by people.

Consequence for runtime

If the calculator alphabet has 36 buttons, increasing K by one multiplies the naive search space by about 36. Parallel CPU workers and WebGPU help, but the combinatorial growth remains the central limitation.

Notation and ranking

Candidate formulas should be judged by both numerical accuracy and complexity. Long formulas can fit many decimal inputs by accident.

SymbolMeaning
ztarget numerical value
Delta zabsolute uncertainty of the input value
delta zrelative uncertainty Delta z / z
Klength of the RPN code being searched
RPNreverse Polish notation button sequence
CRcompression-style ranking signal balancing error and length

Scientific examples

These examples are checks for numerical work and teaching: each one shows what was entered, what candidate was found, and what still has to be verified.

High-precision numerical calculation

z = 0.51404189589007076139762973957688candidate = 5*pi^2/96

A typical use case: a numerical integral or algebraic manipulation returns a decimal and the recognizer proposes a compact form.

Rational recognition

z = 0.22222222222candidate = 2/9

Useful for teaching why decimal representations can hide very simple exact values.

Exercise generation

z = 0.846153846153846candidate = tanh(log(sqrt(12))) = 11/13

An example of an identity that is not obvious from the decimal representation and can become a problem for students.

Recreational integer identity

z = 2026candidate = 1 + (9*5)^2

Integer and date-like inputs are not scientific evidence by themselves, but they are useful demonstrations of the search space.

Limitations

Constant recognition is exploratory. A very close numerical match can still be meaningless if the expression is too long, if the input precision is overstated, or if the expression has no connection with the original problem.

Minimum reporting checklist

  • Target value and number of significant digits.
  • Assumed Delta z or statement that the search was exact.
  • Maximum K and selected calculator/domain.
  • Candidate expression and independent verification method.

Citation and attribution

If the tool contributes to a publication, cite the repository or deployed version and include the search parameters needed to reproduce the candidate.

Constant Recognition, A. Odrzywolek and K. Sroka.
Inverse RPN calculator for numerical constant recognition.
https://github.com/Klaudiusz321/ConstantRecognition1