Equation Solver

Real & integer nonlinear systems

Powered by your C++ solver

Find the values that fit.

Enter your equations, choose a search budget, and solve. Declare fixed constants, restrict whole-number variables, and include bounds directly with your equations.

One equation or declaration per line
Try an example

Selecting an example replaces the equations and bound overrides. Editing equations or opening an equation file clears previous bound overrides. Time, precision, tolerance and other search settings stay as entered.

Word problem · 3 equations · integer counts

Who planted the trees?

For Earth Day, each male student plants 5 trees and each female student plants 4. Together they plant 2,200 trees. The total number of students plus the ratio of males to females is 481.4. How many male and female students took part?

Counts must be whole numbers; the ratio uses ordinary division. Selecting this example loads bounds: male and students 0–1000, female 1–1000.

constant k=40; defines a fixed input. int x, y; restricts unknowns to integers. bound x=[0,sqrt(k)]; sets an inclusive range. Use #e and #pi for built-in constants.

Results appear below.
Equation syntax & search tips

Writing equations and declarations

  • Put each equation or declaration on a separate line, or separate statements with semicolons. Expressions inside balanced parentheses may span lines. An expression without = means that expression equals zero.
  • Fixed inputs: constant k=40; or const k=40;. Alternatively, write constant a1, a2;, then a1=40; and a2=sqrt(a1);. Constants may depend on other constants in any order; they are excluded from the unknowns. Each inline declaration accepts one initializer.
  • Whole-number unknowns: int male, female, students; or integer male, female, students;. Other unknowns are real-valued. Integers may be negative unless their bounds forbid it. Division remains real-valued even for integers: 280/200 = 1.4.
  • Names are case-sensitive and start with a letter or underscore, followed by letters, digits or underscores. #e is Euler's number; bare e is an ordinary variable. Both pi and #pi denote the built-in constant.
  • Use /* block comments */ for comments spanning lines and // line comments for the rest of a line.
  • Operators: +, -, *, /, ^ and **. Powers associate to the right: 2^3^2 = 512. -x^2 means -(x^2).
  • Implicit multiplication is supported: 2x, 3y^2, 2(x+1), x(y+1), (x+1)(y-1), 2sin(x), 2#pi and x y. xy is one variable, so use x*y for two variables.
  • Multiplication and division run left to right: x/2y means (x/2)*y. Write x/(2*y) when that is intended. 2e3 is scientific notation for 2000; use 2*e to multiply the variable e.

Supported functions

  • Trigonometric: sin, cos, tan, asin, acos, atan and atan2(y,x). Angles are in radians.
  • Hyperbolic: sinh, cosh and tanh. Exponential and logarithmic: exp, log/ln (natural logarithm), log10, log1p and expm1. log1p(x) and expm1(x) retain accuracy near zero.
  • Other functions: sqrt(x), cbrt(x), abs(x), pow(x,y), min(x,y), max(x,y) and hypot(x,y). cbrt accepts negative real inputs. Function arguments must be within their real domains, for example positive inputs to log.

Bounds and search settings

  • Optional inclusive bounds: bound x=[0,10*k];. Endpoints must be finite expressions involving constants and functions, rather than unknowns. Declarations may appear before constant definitions. bound x=[2,2]; fixes x at 2. Keep one bound declaration per variable.
  • Per-variable bound overrides in Advanced settings take precedence over global overrides, which take precedence over bounds in the equations. Enter per-variable overrides as name lower upper, one per line, using numeric endpoints.
  • Variables without explicit bounds use expanding automatic ranges. Initial search radius, Search stages and Radius growth factor control that expansion. Explicit bounds stay fixed. Useful bounds can make difficult searches faster.
  • Time budget limits elapsed search time. Starting points and Iterations per start control search effort; either budget may finish before the time limit. Maximum solutions limits how many distinct roots are returned.
  • Changing the Random seed explores different starting points. Root merge tolerance controls when nearby real-coordinate solutions count as the same root; an overly large value may merge distinct nearby roots.
  • Extra integer neighbors controls additional nearby integer assignments. The solver also tries a dedicated search for all-integer systems with affine equations and can derive auxiliary values such as f=abs(a)+abs(b). This discrete search has finite budgets and does not enumerate every integer assignment.
  • Avoid returning to known roots, Infer bounds from equations and Search zero and small-integer slices provide additional search strategies. Single-variable polynomial equations up to degree 64 also receive a separate root search within the configured range.
  • Selecting an example replaces the equations and bound overrides. Editing equations or opening an equation file clears previous bound overrides. Time, precision, tolerance and other search settings stay as entered.

Precision and interpreting results

  • Residual tolerance is the maximum allowed absolute equation error for a returned solution. The default is 1e-9 for double precision and 1e-24 for binary128. Switching the precision checkbox resets the tolerance to that precision's default; enter any custom tolerance after selecting the precision.
  • The solver first searches for approximate roots, then refines candidates to the requested tolerance. Binary128 uses the same double-precision discovery with higher-precision final refinement, providing about 33 decimal digits of significand precision. It requires a solver build with binary128 support.
  • A smaller tolerance requests a stricter residual check and can reduce the number of accepted roots or increase refinement time. More time, more starting points, another seed or suitable bounds may help. Residual tolerance does not guarantee the same accuracy in each variable; achievable accuracy depends on conditioning and arithmetic precision.
  • Every returned solution is checked against the original equations, integer declarations and bounds. The search is heuristic: finding no root does not prove there is none, and finding several roots does not prove all have been found. Polynomial root searches also do not certify completeness.
  • This front end calls equation_solver without an objective. Supported builds accept >= and <= conditions alongside equations. min and max are expression functions. Objective declarations such as minimize/maximize require the separate optimizer program.