eqdisco.benchmarks.is_symbolic_solution#

eqdisco.benchmarks.is_symbolic_solution(found, truth, feature_names=None, digits=3, X=None, tol=1e-06, affine=False)[source]#

True if found - truth is constant or found / truth is a nonzero constant.

Parameters:
foundEquation, SymPy expression or str
truthSymPy expression or str
digitsint

Floating constants of found are rounded to this many significant digits (and snapped to nearby simple rationals) before the symbolic test.

Xarray_like, optional

If given, a numerical test on X is used when the symbolic one is inconclusive: the standard deviation of the difference (or of the ratio) relative to that of the true values must be below tol.

affinebool, default=False

Also accept found = a + b * truth (equivalence up to the linear scaling that eqdisco applies to every candidate), tested numerically on X (or on random points of [0.5, 2] when X is not given). This is a relaxation of the SRBench criterion and is reported as such.

Examples using eqdisco.benchmarks.is_symbolic_solution#

A first search: Kepler’s third law from the planets

A first search: Kepler's third law from the planets

A one-page report of a search

A one-page report of a search