Symbolic vs numerical math: a research note guide
October 16, 2026 · Oyren AI Team (AI-written)

TL;DR: Label a research result as a symbolic expression, exact value, numerical approximation or proof, then record the assumptions and inputs that support it. Free Oyren Docs handles LaTeX and SOLVE calculations; symbolic algebra belongs in a tool such as SymPy, and formal Lean 4 and Mathlib proofs run in an Oyren Codespace.
Choose or create a workspace, then add a note or source document for the workflow.
| Result | Example | Record in the note |
|---|---|---|
| ResultSymbolic | Example2*x | Record in the noteSymbol domains and assumptions |
| ResultExact | Example3/10 | Record in the noteHow the input was constructed |
| ResultNumerical | Example1.41421356237310 | Record in the noteInputs, method and precision |
| ResultProof | ExampleA theorem under hypotheses | Record in the noteStatement, hypotheses and proof |
LaTeX formats any of these results without verifying them. The SymPy introduction provides the expression examples below.
A variable and a value
SymPy keeps x free in the first result, then substitutes one value for the second:
from sympy import symbols
x = symbols('x')
expr = x + x
print(expr) # 2*x
print(expr.subs(x, 3)) # 6
The expression 2*x describes a relationship in x. The exact value 6 describes that expression at x = 3.
Exact inputs before arithmetic
Python evaluates numeric literals before SymPy receives them. The SymPy gotchas guide recommends constructing rationals explicitly when exact fractions matter.
from sympy import Rational, symbols
x = symbols('x')
print(1/3) # 0.3333333333333333
print(Rational(1, 3)) # 1/3
print(x + 1/3) # x + 0.333333333333333
print(0.1 + 0.2) # 0.30000000000000004
print(Rational('0.1') + Rational('0.2')) # 3/10
1/3 and 0.1 + 0.2 are Python floating-point calculations; their rounding is present before symbolic work starts. Rational preserves the exact fractions. Python's floating-point tutorial explains the decimal displays.
Domains change simplification
SymPy's assumptions guide shows why the domain of a symbol belongs beside an identity:
from sympy import Symbol, sqrt
x = Symbol('x')
r = Symbol('r', real=True)
p = Symbol('p', positive=True)
print(sqrt(x**2)) # sqrt(x**2)
print(sqrt(r**2)) # Abs(r)
print(sqrt(p**2)) # p
An unrestricted x may be complex; a real r may be negative; a positive p has a fixed sign. Writing sqrt(x**2) = x without the needed domain restriction makes the claim false for negative real values.
Printed precision and input accuracy
N and evalf approximate exact expressions to a requested number of digits, as the SymPy evaluation guide describes.
from sympy import N, Rational, sqrt
print(sqrt(2)) # sqrt(2)
print(N(sqrt(2))) # 1.41421356237310
print(sqrt(2).evalf(30)) # 1.41421356237309504880168872421
print(N(0.1, 30)) # 0.100000000000000005551115123126
print(N(Rational(1, 10), 30)) # 0.100000000000000000000000000000
The last two lines print different values because 0.1 entered as a binary float, while Rational(1, 10) is exact. More output digits cannot restore accuracy lost at input. A numerical note records the input construction, library version, precision and comparison tolerance.
From a result to a claim
Testing a symbolic expression on one input checks that case; it does not prove a universal identity. Probe the boundaries of stated assumptions, then match the prose claim to the evidence: numerical runs support results for tested parameters, while a Lean proof establishes its formal statement under explicit hypotheses.
Free Oyren Docs notes evaluate concrete calculation lines with SOLVE, including decimal arithmetic and units, as shown in the SOLVE guide. The maths notes feature places LaTeX and SOLVE beside the research explanation. Symbolic work can stay in SymPy; formal proofs run in an Oyren Codespace on a managed cloud computer.
Choose or create a workspace, then add a note or source document for the workflow.
Open a research workspace