int — Evaluate scalar symbolic indefinite and definite integrals.
int(expr) returns an indefinite integral with respect to the first symbolic variable in expr. int(expr, var) chooses the variable explicitly. int(expr, a, b) and int(expr, var, a, b) evaluate definite integrals by substituting the bounds into the antiderivative.
Syntax
F = int(expr)
F = int(expr, var)
F = int(expr, a, b)
F = int(expr, var, a, b)Inputs
expr- Type
Any- Required
- Yes
- Description
- Scalar symbolic or numeric expression to integrate.
var- Type
Any- Required
- No
- Default
symvar(expr, 1)- Description
- Integration variable as a symbolic variable or text scalar.
a- Type
Any- Required
- No
- Description
- Lower integration bound.
b- Type
Any- Required
- No
- Description
- Upper integration bound.
Returns
F- Type
Any- Description
- Scalar symbolic indefinite or definite integral result.
Errors
RunMat:int:InvalidExpression- When
- The expression cannot be represented as a scalar symbolic expression.
- Message
int: expected a scalar symbolic or numeric expression
RunMat:int:InvalidVariable- When
- The integration variable cannot be inferred or is not a symbolic variable/text scalar.
- Message
int: invalid symbolic variable
RunMat:int:InvalidBound- When
- A definite integration bound cannot be represented as a scalar symbolic expression.
- Message
int: invalid integration bound
Behavior
RunMat prefers x when present, then chooses remaining valid symbolic names in deterministic lexical order; a constant expression defaults to x. This is the current scalar default-variable rule.
Supported closed forms include constants, variables, sums, differences, scalar multiples, powers of the integration variable, reciprocal 1/x, sin, cos, exp, log(x), and sqrt(x).
Definite integrals simplify numeric trigonometric and exponential bounds when the antiderivative can be evaluated.
Unsupported symbolic forms return a formal symbolic int(...) expression instead of failing, preserving downstream symbolic workflows.
IgnoreAnalyticConstraints, PrincipalValue, IgnoreSpecialCases and Hold are recognized MATLAB option names, but RunMat rejects them with RunMat:int:InvalidOption. They are not silently ignored.
Supported scalar forms and limits
Accepts one expression plus zero, one, two or three arguments according to the four listed forms. Expressions and bounds may be symbolic scalars or host real numeric/scalar logical values, including one-element N-D numeric tensors. Explicit variables must be symbolic variable nodes or valid identifier text, never numeric scalars.
The output is always one host symbolic scalar, including a formal unevaluated integral when no elementary primitive is implemented. Zero requested outputs evaluates and discards it; more than one output fails before processing.
All integer classes are recognized, but this integrator currently requires numeric integer expressions and bounds to be exactly representable in binary64; wider numeric integers reject before symbolic conversion. This restriction does not turn int into an integer datatype conversion.
Complex values, symbolic-array and logical-array containers (even one-element), sparse, empty/nonscalar inputs, vector bound syntax and resident/distributed operands are unsupported. Text is accepted only in the variable and rejected-option roles, not as expression or bound input.
Placement and effects
Symbolic integration works on host algebra values and is not uploaded to GPU providers.
GPU and distributed operands, including secondary controls, are not supported. These functions do not upload or gather values and have no device kernel or GPU fusion recipe.
Constructing and transforming symbolic expression trees currently requires unrestricted host allocation. Finite Managed calls reject before unowned symbolic allocation; complete finite expression ownership is not yet implemented.
This portable host operation is pure apart from errors. It does not use callbacks, workspace mutation, filesystem, clock or random services.
Examples
Integrate a polynomial
syms x
F = int(x^2)Expected output:
F = x^3/3Evaluate a definite integral
syms x
A = int(sin(x), 0, pi)Expected output:
A = 2Choose the integration variable explicitly
syms x y
F = int(y, x)Expected output:
F = x*yUsing int with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how int changes the result.
Run a small int example, explain the result, then change one input and compare the output.
FAQ
Does int run on the GPU?⌄
No. Symbolic expressions are host algebra values. Numeric tensors should use numerical integration routines when available.
What happens when RunMat cannot find a closed form?⌄
RunMat returns a formal scalar symbolic int(...) expression so code can continue to manipulate or display the unevaluated integral.
Related Math functions
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
Optim
acceptancesa · annealingboltz · annealingfast · coneprog · crossoverarithmetic · crossoverheuristic · crossoverintermediate · crossoverlaplace · crossoverscattered · crossoversinglepoint · crossovertwopoint · eqnproblem · EquationProblem.solve · 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
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 int is executed, line by line, in Rust.
- View the source for int 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.