EquationProblem.solve — Create an equation problem from symbolic equality expressions.
Store equation arrays and their original optimization-variable definitions in a scalar EquationProblem value.
Syntax
sol = solve(problem[,x0],Name,Value,...)
[sol,fval] = solve(problem[,x0],Name,Value,...)
[sol,fval,exitflag] = solve(problem[,x0],Name,Value,...)
[sol,fval,exitflag,output] = solve(problem[,x0],Name,Value,...)Inputs
problem- Type
Any- Required
- Yes
- Default
- —
- Description
- Original native equation problem.
x0- Type
Any- Required
- No
- Default
- —
- Description
- Original variable-name and shape starting-point structure.
controls- Type
Any- Required
- Variadic
- Default
- —
- Description
- Solver and Options name/value pairs.
Returns
sol- Type
Any- Description
- Original variable-name solution structure.
fval- Type
Any- Description
- Original left-minus-right array, or structure for multiple named equation entries.
exitflag- Type
Any- Description
- OptimizationExitflag for the selected equation solver.
output- Type
Any- Description
- Selected solver, algorithm, stopping message, work counts and wall time.
Errors
RunMat:EqnProblem:InvalidInput- When
- Invalid property, equality collection, original variable definition, or native property path.
- Message
invalid equation problem
RunMat:OptimProblem:NumericalUnverified- When
- A working-model terminal cannot be verified against the original model.
- Message
original model numerical evidence is unverified
Construction and properties
p=eqnproblem creates an empty equation problem. Description defaults to an empty character row and Equations to []. Constructor property names are case-insensitive; direct property access uses Description, Equations and Variables. Duplicate constructor properties are rejected.
Equations accepts an OptimizationEquality array or a scalar structure of named equality arrays. Inequalities are rejected. Assigning [] to a named equation removes that field. Equation field names must be valid identifiers and have a separate namespace from variable names.
Variables is a read-only structure of the complete original variable definitions reachable from both sides of every equation. Distinct variable definitions with the same name cannot be combined. Variable references remain aliases of their original definitions; problem property edits create a new problem value without changing copied problem values.
Solving equations
Use sol=solve(p), solve(p,x0), or [sol,fval,exitflag,output]=solve(p,x0,'Solver',name,'Options',options). x0 is a structure whose fields use original variable names and shapes. Solver and Options are the supported solve name/value parameters. Equation problems return at most four outputs and do not return lambda.
The default solver is lsqlin for affine equations, fzero for one nonlinear residual in one unbounded scalar variable, fsolve for an unbounded nonlinear system, and lsqnonlin for nonlinear equations with variable bounds. Solver can explicitly select lsqlin, fzero, fsolve or lsqnonlin; incompatible geometry or options from another solver are rejected. Integer variable domains are not silently relaxed.
Linear equations use the sparse residual matrix directly, without forming normal equations. Nonlinear systems use the selected residual controller and finite-difference Jacobians. fzero uses scalar bracket expansion and Brent interpolation/bisection. Nonlinear solvers require x0. Linear interior-point solving does not inspect an inactive x0; reflective and active-set methods use their selected starting-point contract.
sol contains original variable names and shapes. fval is left minus right in the original equation-array shape when there is one equation entry, even when that entry has a name. Multiple named entries return a structure with those names and shapes. The reported residual comes from the retained source evaluation, without a final function reevaluation.
Equation convergence code 1 returns EquationSolved (double value 1). StepSizeBelowTolerance and FunctionChangeBelowTolerance retain their solver-specific numeric reasons. The scalar fzero controller retains its numerical bracket/step convergence, including a small nonzero rounded residual; it does not require exact floating-point zero. Its output.rootcriterion identifies numerical-bracket-or-zero. This numerical status is not an exact-zero or global certificate.
A least-squares stationary point with a nonzero residual is not an equation solution. A positive residual-solver stop is qualified against its equation tolerance; a nonzero residual returns NoFeasiblePointFound, meaning no solution was found, not a proof that no root exists. Limits preserve the solver's stopping reason and available candidate. output identifies the selected solver and algorithm, its counts and message; requesting output also requires the invocation's Clock service.
Resources and supported boundaries
Model compilation and solver workspaces require an unbounded host-memory policy. Cancellation and operational failures propagate through the original invocation. EquationProblem uses the native value-class, rooting and copy-on-write owners; model DAG persistence and worker transport are not supported. No displayed-property serialization substitutes for the equation graph.
EquationDerivative controls, automatic differentiation, global/multiple-start equation solving and additional equation solver selections are not implemented. Numerical and resource limits of the selected raw solver remain applicable.
Using EquationProblem.solve with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how EquationProblem.solve changes the result.
Run a small EquationProblem.solve example, explain the result, then change one input and compare the output.
Related Math functions
Optim
acceptancesa · annealingboltz · annealingfast · coneprog · crossoverarithmetic · crossoverheuristic · crossoverintermediate · crossoverlaplace · crossoverscattered · crossoversinglepoint · crossovertwopoint · eqnproblem · EquationProblem.subsasgn · EquationProblem.subsref · evaluate · fgoalattain · fitscalingprop · fitscalingrank · fitscalingshiftlinear · fitscalingtop · fminbnd · fmincon · fminimax · fminsearch · fminunc · fseminf · fsolve · fzero · ga · gacreationlinearfeasible · gacreationnonlinearfeasible · gacreationsobol · gacreationuniform · gacreationuniformint · gaplotbestf · gaplotbestindiv · gaplotdistance · gaplotexpectation · gaplotgenealogy · gaplotmaxconstr · gaplotrange · gaplotscorediversity · gaplotscores · gaplotselection · gaplotstopping · integerConstraint · integral · intlinprog · linprog · lsqcurvefit · lsqlin · LsqlinWarmStart.subsasgn · LsqlinWarmStart.subsref · lsqnonlin · lsqnonneg · mutationadaptfeasible · mutationgaussian · mutationpositivebasis · mutationpower · mutationuniform · optimexpr · optimget · OptimizationConstraint.evaluate · OptimizationConstraint.subsasgn · OptimizationConstraint.subsref · OptimizationExitflag.double · OptimizationExitflag.eq · OptimizationExitflag.ne · OptimizationExitflag.string · OptimizationExpression.acos · OptimizationExpression.acosh · OptimizationExpression.acot · OptimizationExpression.acoth · OptimizationExpression.acsc · OptimizationExpression.acsch · OptimizationExpression.asec · OptimizationExpression.asech · OptimizationExpression.asin · OptimizationExpression.asinh · OptimizationExpression.atan · OptimizationExpression.atanh · OptimizationExpression.cat · OptimizationExpression.cos · OptimizationExpression.cosh · OptimizationExpression.cot · OptimizationExpression.coth · OptimizationExpression.csc · OptimizationExpression.csch · OptimizationExpression.ctranspose · OptimizationExpression.cumprod · OptimizationExpression.cumsum · OptimizationExpression.diag · OptimizationExpression.diff · OptimizationExpression.dot · OptimizationExpression.eq · OptimizationExpression.evaluate · OptimizationExpression.exp · OptimizationExpression.ge · OptimizationExpression.horzcat · OptimizationExpression.ldivide · OptimizationExpression.le · OptimizationExpression.log · OptimizationExpression.mean · OptimizationExpression.minus · OptimizationExpression.mldivide · OptimizationExpression.mpower · OptimizationExpression.mrdivide · OptimizationExpression.mtimes · OptimizationExpression.norm · OptimizationExpression.plus · OptimizationExpression.power · OptimizationExpression.prod · OptimizationExpression.rdivide · OptimizationExpression.reshape · OptimizationExpression.sec · OptimizationExpression.sech · OptimizationExpression.sin · OptimizationExpression.sinh · OptimizationExpression.sqrt · OptimizationExpression.subsasgn · OptimizationExpression.subsref · OptimizationExpression.sum · OptimizationExpression.tan · OptimizationExpression.tanh · OptimizationExpression.times · OptimizationExpression.trace · OptimizationExpression.transpose · OptimizationExpression.uminus · OptimizationExpression.uplus · OptimizationExpression.vertcat · OptimizationExpression.zeros · OptimizationExpression.zerosLike · OptimizationProblem.solve · OptimizationProblem.subsasgn · OptimizationProblem.subsref · OptimizationVariable.subsasgn · OptimizationVariable.subsref · optimoptions · optimplotconstrviolation · optimplotfirstorderopt · optimplotfunccount · optimplotfval · optimplotfvalconstr · optimplotmilp · optimplotstepsize · optimplotx · optimproblem · optimset · optimvar · optimwarmstart · particleswarm · patternsearch · psplotbestf · psplotbestx · psplotfuncount · psplotmaxconstr · psplotmeshsize · pswcreationuniform · pswplotbestf · quad · quadprog · QuadprogWarmStart.subsasgn · QuadprogWarmStart.subsref · saplotbestf · saplotbestx · saplotf · saplotstopping · saplottemperature · saplotx · savemilpsolutions · secondordercone · selectionremainder · selectionroulette · selectionstochunif · selectiontournament · selectionuniform · simulannealbnd · solve · surrogateopt · surrogateoptplot · temperatureboltz · temperatureexp · temperaturefast
Elementwise
abs · angle · besselj · bsxfun · complex · conj · double · eps · erf · erfcinv · exp · expm1 · flintmax · gamma · gammaln · heaviside · hypot · imag · int16 · int32 · int64 · int8 · intmax · intmin · ldivide · log · log10 · log1p · log2 · minus · nextpow2 · plus · pow2 · power · rdivide · real · realmax · realmin · realsqrt · rescale · sign · single · sqrt · times · typecast · uint16 · uint32 · uint64 · uint8
Trigonometry
acos · acosd · acosh · acotd · acscd · asecd · asin · asind · asinh · atan · atan2 · atan2d · atand · atanh · cos · cosd · cosh · cospi · deg2rad · pol2cart · rad2deg · sin · sind · sinh · sinpi · tan · tand · tanh
Reduction
all · any · bounds · cummax · cummin · cumprod · cumsum · cumtrapz · diff · gradient · max · maxk · mean · median · min · mink · movmax · movmean · movmedian · movmin · movprod · movstd · movsum · movvar · nnz · prod · rms · std · sum · trapz · var
Structure
bandwidth · isdiag · ishermitian · issymmetric · istril · istriu · symrcm
Signal
blackman · butter · buttord · cheb2ord · conv · conv2 · deconv · downsample · envelope · filter · filtfilt · fir1 · freqz · gauspuls · hamming · hann · hilbert · periodogram · pulstran · pwelch · rectpuls · resample · sawtooth · sinc · spectrogram · square · tripuls · unwrap · upsample · zplane
Factor
chol · decomposition · decomposition.ctranspose · decomposition.mldivide · decomposition.mrdivide · decomposition.mtimes · decomposition.rdivide · decomposition.subsref · decomposition.times · decomposition.uminus · decomposition.uplus · eig · eigs · gmres · ichol · ilu · lu · ordeig · ordqz · ordschur · pcg · qr · qz · rsf2csf · schur · svd
Ops
cross · ctranspose · dot · mldivide · mpower · mrdivide · mtimes · pagemtimes · pagetranspose · trace · transpose
Interpolation
griddedInterpolant · griddedInterpolant.subsref · interp1 · interp1q · interp2 · pchip · ppval · spline
Integer Division
Source you can read
Every RunMat function's source is public. Read exactly how EquationProblem.solve is executed, line by line, in Rust.
- View the source for EquationProblem.solve in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.