Inactive[f]
is an inactive form of f.
Inactive
Inactive[f]
is an inactive form of f.
Details
- Inactive[f][args] is effectively a purely symbolic form of f[args], in which no evaluation associated with f is done.
- Inactive is conveniently inserted into expressions using Inactivate.
- Inactive[f] displays in StandardForm, with f or any special output form associated with f shown in gray.
- Inactive does not affect TraditionalForm.
- Inactive has the attribute HoldFirst and does not evaluate its first argument.
- Inactive[atom] gives atom for atoms other than symbols.
Examples
open all close allBasic Examples (3)
Inactive Length:
Inactive[Length][{a, b, c}]Activate[%]Inactivate Plus:
Inactivate[2 + 2]Display equality of activated and inactivated forms:
% == Activate[%]Inactive objects are grayed out in StandardForm:
Inactive[Sin][0]But not in TraditionalForm:
TraditionalForm[%]Scope (13)
Basic Uses (5)
Define an inactive expression:
expr = Inactive[Sin][π / 2]Evaluate the expression using Activate:
Activate[expr]Create an inactive expression using Inactivate:
expr = Inactivate[Sin[Pi / 2], Sin]Activate[expr]Expression with two inactive terms:
expr = Inactive[Cos][(π/3)] + Inactive[Sin][(π/3)]Activate different parts of the expression:
Activate[expr, Sin]Activate[expr, Cos]Activate[expr]Inactivate[f[g[h[x]], y, g[z]], g]Activate[%]Inactivate[f[g[h[x]], y, g[z]], g | h]Activate[%, h]Formal Operations (5)
An inactive form of an integral:
Inactive[Integrate][1 / (1 + x), x]Differentiate the inactive form:
D[%, x]Formally differentiating a Laplace transform:
Inactive[LaplaceTransform][a t ^ 2, t, s]D[%, s]Activate[%]D[LaplaceTransform[a t ^ 2, t, s], s]Similarly differentiating wrt t and a:
e = Inactive[LaplaceTransform][a t ^ 2, t, s]D[e, t]D[e, a]Differentiate operators including Integrate:
Inactive[Integrate][f[x], {x, a[x], b[x]}]D[%, x]Inactive[FourierTransform][f[t], t, ω]D[%, ω]Inactive[FourierSinTransform][f[t], t, ω]D[%, ω]Inactive[Convolve][f[t], g[t], t, s]D[%, s]Sum:
Inactive[Sum][f[k, y], {k, a, b}]D[%, y]Inactive[ZTransform][f[k], k, z]D[%, z]Difference operators including Sum:
Inactive[Sum][f[k], k]DifferenceDelta[%, k]Inactive[DiscreteConvolve][f[m], g[m], m, n]DifferenceDelta[%, n]Inactive[Integrate][f[x], {x, a, b}]DifferenceDelta[%, b]Inactive[LaplaceTransform][f[t], t, s]DifferenceDelta[%, s]Other formal operations including Product:
Inactive[DiscreteRatio][f[k], k]Product[%, k]Inactive[InverseZTransform][F[z], z, k + 1]ZTransform[%, k, z]Inactive[InverseZTransform][F[z], z, k]ZTransform[k %, k, z]Code Transformations (3)
Inactivate a function definition:
Inactivate[forSquares[f_, max_] := For[x = 1, x < max, x++, Print[f[x ^ 2]]]]Transform a For statement into a Do statement:
% //. Inactivate[For[i_ = init_, i_ < max_, i_++, body_] :> Do[body, {i, init, max}]]Activate and use the definition:
Activate[%]forSquares[Range, 3]Replace With by an iterated version, so that later variables can refer to earlier ones:
SetAttributes[IterateWith, HoldAll]
IterateWith[expr_] := Activate[Inactivate[expr] //. Inactive[With][{first_, rest__}, body_] :> Inactive[With][{first}, Inactive[With][{rest}, body]]]With[{a = 3, b = a + 2, c = a + b}, {a, b, c}]IterateWith[With[{a = 3, b = a + 2, c = a + b}, {a, b, c}]]Inactivate Length:
Inactivate[{Length[{a, b, c}], Length[{b, c}], Length[{Length[{a}], Length[{b}], Length[{c}], 7}]}, Length]Change the measure to be the square of the length:
% //. Inactive[Length][x_] :> Length[x] ^ 2Applications (25)
Basic Identities (4)
Block[{e = Inactivate[23 + 11]}, e == Activate[e]]Make a whole table of identities:
Table[Block[{e = Inactivate[n + m]}, e == Activate[e]], {n, 0, 3}, {m, 0, 3}]//Grid//TraditionalFormBlock[{e = Inactivate[3 5]}, e == Activate[e]]Make a whole table of identities:
Table[Block[{e = Inactivate[n m]}, e == Activate[e]], {n, 0, 3}, {m, 0, 3}]//Grid//TraditionalFormBlock[{e = Inactivate[x + 1 + 5x]}, e == Activate[e]]//TraditionalFormBlock[{e = Inactivate[x x x^3]}, e == Activate[e]]Table[Inactive[Sin][k π / 6] == Sin[k π / 6], {k, 0, 3}]//Column//TraditionalFormFunction Identities (3)
Sin is an odd function of its argument:
Block[{e = Inactivate[Sin[-x], Sin]}, e == Activate[e]]//TraditionalFormCos is an even function of its argument:
Block[{e = Inactivate[Cos[-x], Cos]}, e == Activate[e]]//TraditionalFormHyperbolic functions with imaginary arguments are equivalent to trigonometric functions:
Block[{e = Inactivate[Sinh[I x], Sinh]}, e == Activate[e]]//TraditionalFormBlock[{e = Inactivate[Cosh[I x], Cosh]}, e == Activate[e]]//TraditionalFormBesselJ[1,x] is an odd function of x:
Block[{e = Inactivate[BesselJ[1, -x], BesselJ]}, TraditionalForm[e] == Activate[e]]BesselJ[2,x] is an even function of x:
Block[{e = Inactivate[BesselJ[2, -x], BesselJ]}, TraditionalForm[e] == Activate[e]]Calculus Identities (9)
Show identities, including Leibniz's rule for differentiating integrals:
Inactivate[Subscript[∂, x]Subsuperscript[∫, a[x], b[x]]f[x]ⅆx, D | Integrate] == Subscript[∂, x]Subsuperscript[∫, a[x], b[x]]f[x]ⅆxInactivate[D[f[x] g[x], x], D] == D[f[x]g[x], x]Inactivate[D[f[g[x]], x], D] == D[f[g[x]], x]Inactivate[Integrate[x ^ n, x], Integrate] == Integrate[x ^ n, x]Inactivate[Integrate[1 / Sqrt[1 - x ^ 2], x], Integrate] == Integrate[1 / Sqrt[1 - x ^ 2], x]Inactivate[Sum[1 / n ^ 2, {n, 1, Infinity}], Sum] == Sum[1 / n ^ 2, {n, 1, Infinity}]//TraditionalFormInactivate[Product[1 - 1 / n ^ 4, {n, 2, Infinity}], Product] == Product[1 - 1 / n ^ 4, {n, 2, Infinity}]//TraditionalFormFinite and infinite continued fractions:
Inactive[ContinuedFractionK][1, 2, {n, 1, m}] == ContinuedFractionK[1, 2, {n, 1, m}]//TraditionalFormInactive[ContinuedFractionK][n, {n, 1, Infinity}] == ContinuedFractionK[n, {n, 1, Infinity}]//TraditionalFormApply DifferenceDelta to an inactive sum:
Timing[DifferenceDelta[Inactive[Sum][(1 + x) ^ 150, x], x]]This is significantly faster than the evaluated version:
Timing[DifferenceDelta[Sum[(1 + x) ^ 150, x], x]]Formula for summation by parts:
sumparts = Inactivate[Sum[f[k] g[k], k] == g[k]Sum[f[k], k] - Sum[DifferenceDelta[g[k], k]DiscreteShift[Sum[f[k], k], k], k], Sum | DifferenceDelta | DiscreteShift]Verify the formula in a special case:
f[k_] := kg[k_] := PolyGamma[k]Activate[sumparts]Inactive[Sum][k PolyGamma[k], k] == Sum[k PolyGamma[k], k]Interchange the order of summation and integration:
(id = Inactivate[Sum[Integrate[t ^ (n - 1)E ^ (-t) / (2n + 1)!!,
{t, 0, Infinity}], {n, 1, Infinity}] ==
Integrate[
Sum[E ^ (-t)t ^ (n - 1) / (2n + 1)!!, {n, 1, Infinity}], {t, 0, Infinity}], Sum | Integrate])//TraditionalFormEvaluate both sides of the identity:
{Activate[id[[1]]], Activate[id[[2]]]}//TogetherObtain the same result using the corresponding sum:
Underoverscript[∑, n = 1, ∞](Gamma[n]/(2 n + 1)!!)The product rule for the Laplacian:
Inactivate[Laplacian[f[x, y] g[x, y], {x, y}] == f[x, y] Laplacian[g[x, y], {x, y}] + g[x, y] Laplacian[f[x, y], {x, y}] + 2 Grad[f[x, y], {x, y}].Grad[g[x, y], {x, y}], Laplacian | Grad]//TraditionalFormActivate[%]//SimplifyVector identities for three-vectors u, v, and w:
u = {ux, uy, uz};
v = {vx, vy, vz};
w = {wx, wy, wz};Antisymmetry of the cross product:
Inactivate[Cross[v, v], Cross] == Cross[v, v]%//ActivateOrthogonality of the cross product:
Inactive[Dot][u, Inactive[Cross][u, v]] == Inactive[Dot][v, Inactive[Cross][u, v]] == 0%//Activate//SimplifyInactive[Dot][u, Inactive[Cross][v, w]] == Inactive[Det][{u, v, w}]%//Activate//SimplifyDerive Identities (5)
The basic commutation trick for differentiating under the integral or summation sign:
Inactivate[Integrate[D[f[x, a], a], x] == ((D[Integrate[f[x, a], x], a]))]Inactivate[Sum[D[f[x, a], a], x] == ((D[Sum[f[x, a], x], a]))]Derive a closed form for
by differentiating
with respect to
at
:
D[Inactive[Integrate][E ^ (a x), x], a]lhs = % /. a -> 1Now integrate
and then differentiate with respect to
at
:
Integrate[E ^ (a x), x]D[%, a]rhs = % /. a -> 1//FullSimplifylhs == rhsActivate[%]Derive a closed form for
by differentiating
with respect to
at zero:
D[Inactive[Integrate][E ^ (-x)x ^ a, {x, 1, ∞}], a]lhs = % /. a -> 0
is first integrated and then differentiated with respect to
at zero:
Integrate[E ^ (-x)x ^ a, {x, 1, ∞}]D[%, a]rhs = % /. a -> 0//FullSimplifylhs == rhsActivate[%]Derive a closed form for
by differentiating
with respect to
at
:
D[Inactive[Sum][E ^ (a k), k], a]lhs = % /. a -> -1Compute
and then differentiate:
Sum[E ^ (a k), k]D[%, a]rhs = % /. a -> -1//Simplifylhs == rhsActivate[%]//SimplifyDerive a closed form for
by differentiating
wrt
at
:
D[Inactive[Sum][Exp[a k^2], {k, -∞, ∞}], a]lhs = % /. a -> -1Compute
and then differentiate:
Sum[Exp[a k^2], {k, -∞, ∞}]D[%, a]rhs = % /. a -> -1lhs == rhsTable[D[Inactive[Sum][Exp[a k^2] , {k, -∞, ∞}], {a, n}] == D[Sum[Exp[a k^2] , {k, -∞, ∞}], {a, n}] /. a -> -1, {n, 1, 3}]//ColumnSolve Differential Equations (2)
Solution for the three-dimensional Laplace equation in inactive integral form:
V[x_, y_, z_] := Inactive[Integrate][f[z + I*x*Cos[u] + I*y*Sin[u], u], {u, -Pi, Pi}]Obtain a particular solution by specifying the function f:
f[a_, b_] := 2a ^ 5 + b ^ 4V[x, y, z]sol = Activate[%]//SimplifyRow[Table[Plot3D[sol /. {z -> j}, {x, -3, 3}, {y, -3, 3}, Ticks -> {Automatic, Automatic, None}], {j, -2, 2}]]Laplacian[sol, {x, y, z}]//SimplifyMaxwell's equations in natural Lorentz–Heaviside units:
Inactivate[{gaussE = Div[ℰ[x, y, z, t], {x, y, z}] == ρ[x, y, z, t], gaussB = Div[ℬ[x, y, z, t], {x, y, z}] == 0, faraday = Curl[ℰ[x, y, z, t], {x, y, z}] == -D[ℬ[x, y, z, t], t], ampere = Curl[ℬ[x, y, z, t], {x, y, z}] == j[x, y, z, t] + D[ℰ[x, y, z, t], t]}, Div | Curl | D];
%//TableForm//TraditionalFormTake the curl of Ampere's law in a vacuum (
and
):
Inactive[Curl][#, {x, y, z}]& /@ ampere /. j -> (0&)Interchange order of differentiation:
% /. Inactive[Curl][Inactive[D][v_, t_], x_] :> Inactive[D][Inactive[Curl][v, x], t]% /. Solve[faraday, Inactive[Curl][ℰ[x, y, z, t], {x, y, z}]][[1]]Activate the equation, resulting in the wave equation for the magnetic field:
wave = Activate[%]Verify plane-wave solutions of the equation:
wave /. ℬ -> (A Exp[{kx, ky, kz}.{#1, #2, #3} - ISqrt[kx ^ 2 + ky ^ 2 + kz ^ 2]#4]&)//SimplifyDerive a Least-Squares Solution (1)
Define the sum of squares of the vertical deviations for a given set of data:
squareDeviations = Inactivate[Sum[(y[[x]] - (a x + b)) ^ 2, {x, 1, n}], Sum | Part]Set up the least-squares equations:
eqna = D[squareDeviations, a] == 0eqnb = D[squareDeviations, b] == 0n = 200;y = Table[3x + 20 + RandomReal[{-15, 15}], {x, 1, n}];ListPlot[y]Solve the least-squares problem for this data:
a x + b /. Solve[Activate[{eqna, eqnb}], {a, b}][[1]]Code Transformation (1)
Replace uses of Module using Block with unique variables:
Blockhead[icode_] :=
icode //. Inactive[Module][vars_, body_] :>
(Inactive[Block][vars, body] /. (rule = Thread[# -> Unique[#]])&[Replace[vars, (Inactive[Set][var_, val_] | var_) :> var, {1}]])code = Inactivate[f[s_] := Module[{x, y = Module[{x = 5 s}, x + 7]}, x = y ^ 2; Sin[x]]]Applying the function replaces the Module local variables with unique variables:
bcode = Blockhead[code]Activate the code and the transformed code to make definitions for f and fb:
Activate[code];
Activate[bcode /. f -> fb];Compare values for random test values:
testvalues = RandomReal[1, 5];
{f[#], fb[#]}& /@ testvaluesCompare timings for a large set of test values:
testvalues = RandomReal[1, 10 ^ 5];
{AbsoluteTiming[Total[f /@ testvalues]], AbsoluteTiming[Total[fb /@ testvalues]]}Properties & Relations (5)
Inactive expressions can be created using Inactivate:
Inactivate[f[x], f]Inactive expressions can be evaluated using Activate:
f[x_] := x ^ 2expr = Inactive[f][3]Activate[expr]Inactive creates inactive forms of symbols and allows parts of expressions to be inactive:
isin = Inactive[Sin][ArcTan[1]]Activate[isin]Hold maintains the expression in unevaluated form, and all parts are inactive:
esin = Hold[Sin[ArcTan[1]]]ReleaseHold[%]Compare an inactive expression with the corresponding FullForm:
Inactivate[Cos[x Sin[y]]]FullForm[Cos[x Sin[y]]]Inactive prevents the attributes of its argument from having any effect:
SetAttributes[f, Listable]
Inactive[f][{1, 2, 3}]Normally, the Listable attribute would cause f to thread over its arguments:
f[{1, 2, 3}]Possible Issues (1)
Neat Examples (1)
Create a gallery of multivariate sums:
multisums = Inactivate[{Underoverscript[∑, m = 2, ∞]Underoverscript[∑, n = 1, ∞](1/(2 n)^m), Underoverscript[∑, m = 1, ∞]Underoverscript[∑, n = 1, ∞](1/(4 n - 1)^2 m), Underoverscript[∑, i = 1, ∞]Underoverscript[∑, j = 1, ∞](Zeta[i + j]/2^i + j), Underoverscript[∑, i = 1, ∞]Underoverscript[∑, j = 1, ∞](1/(i + j)!), Underoverscript[∑, i = 1, ∞]Underoverscript[∑, j = 1, ∞](1/Max[i, j]!), Underoverscript[∑, i = 1, ∞]Underoverscript[∑, j = 1, ∞](1/Max[i, j]^3), Underoverscript[∑, i = 1, ∞]Underoverscript[∑, j = 1, ∞]Underoverscript[∑, k = 1, ∞](1/(i j + j k)^s), Underoverscript[∑, m = 1, ∞]Underoverscript[∑, n = 1, ∞](Zeta[m + 2 n]/4^(m/2) + n), Underoverscript[∑, i = 0, ∞]Underoverscript[∑, j = 0, ∞]Underoverscript[∑, k = 1, ∞](1/(i + 2 j + k)^4)}, Sum];FormulaGallery[forms_List] := Grid[ParallelMap[{# == Simplify@Activate[#]}&, forms], Dividers -> All, Alignment -> {"=", Baseline}, Background -> {{}, {{LightDarkSwitched[RGBColor[0.87, 0.94, 1]], None}}}, Spacings -> {4, 1}];FormulaGallery[multisums]//TraditionalFormRelated Guides
Related Workflows
- Handle Code Symbolically
History
Text
Wolfram Research (2014), Inactive, Wolfram Language function, https://reference.wolfram.com/language/ref/Inactive.html.
CMS
Wolfram Language. 2014. "Inactive." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Inactive.html.
APA
Wolfram Language. (2014). Inactive. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Inactive.html
BibTeX
@misc{reference.wolfram_2026_inactive, author="Wolfram Research", title="{Inactive}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/Inactive.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_inactive, organization={Wolfram Research}, title={Inactive}, year={2014}, url={https://reference.wolfram.com/language/ref/Inactive.html}, note=[Accessed: 12-June-2026]}