# 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 allclose all

## Basic Examples(3)

Inactive Length:

Evaluate the expression:

Inactivate Plus:

Display equality of activated and inactivated forms:

Inactive objects are grayed out in StandardForm:

## Scope(13)

### Basic Uses(5)

Define an inactive expression:

Evaluate the expression using Activate:

Create an inactive expression using Inactivate:

Evaluate the expression:

Expression with two inactive terms:

Activate different parts of the expression:

Inactivate the symbol g only:

Activate g:

Inactivate g and h:

Activate h:

### Formal Operations(5)

An inactive form of an integral:

Differentiate the inactive form:

Formally differentiating a Laplace transform:

Similarly differentiating wrt t and a:

Differentiate operators including Integrate:

Sum:

Difference operators including Sum:

Other formal operations including Product:

### Code Transformations(3)

Inactivate a function definition:

Transform a For statement into a Do statement:

Activate and use the definition:   Replace With by an iterated version, so that later variables can refer to earlier ones:

Inactivate Length:

Change the measure to be the square of the length:

## Applications(25)

### Basic Identities(4)

Show a sum identity:

Make a whole table of identities:

Show a product identity:

Make a whole table of identities:

Show algebraic identities:

Common trigonometric values:

### Function Identities(3)

Sin is an odd function of its argument:

Cos is an even function of its argument:

Hyperbolic functions with imaginary arguments are equivalent to trigonometric functions:

BesselJ[1,x] is an odd function of x:

BesselJ[2,x] is an even function of x:

### Calculus Identities(9)

Show identities, including Leibniz's rule for differentiating integrals:

Product rule:

Chain rule:

Indefinite integrals:

Infinite sums and products:

Finite and infinite continued fractions:

Apply DifferenceDelta to an inactive sum:

This is significantly faster than the evaluated version:

Formula for summation by parts:

Verify the formula in a special case:

Evaluate the sum:

Interchange the order of summation and integration:

Evaluate both sides of the identity:

Obtain the same result using the corresponding sum:

The product rule for the Laplacian:

Vector identities for three-vectors u, v, and w:

Antisymmetry of the cross product:

Orthogonality of the cross product:

Scalar triple product:

### Derive Identities(5)

The basic commutation trick for differentiating under the integral or summation sign:

Derive a closed form for by differentiating with respect to at :

Now integrate and then differentiate with respect to at :

The final result:

Verify the result:

Derive a closed form for by differentiating with respect to at zero: is first integrated and then differentiated with respect to at zero:

The final result:

Verify the result:

Derive a closed form for by differentiating with respect to at :

Compute and then differentiate:

The result:

Verify the result:

Derive a closed form for by differentiating wrt at :

Compute and then differentiate:

The result:

Generalize to :

### Solve Differential Equations(2)

Solution for the three-dimensional Laplace equation in inactive integral form:

Obtain a particular solution by specifying the function f:

Visualize the solution:

Verify the solution:

Maxwell's equations in natural LorentzHeaviside units:

Take the curl of Ampere's law in a vacuum ( and ):

Interchange order of differentiation:

Activate the equation, resulting in the wave equation for the magnetic field:

Verify plane-wave solutions of the equation:

### Derive a Least-Squares Solution(1)

Define the sum of squares of the vertical deviations for a given set of data:

Set up the least-squares equations:

Generate some data:

Solve the least-squares problem for this data:

### Code Transformation(1)

Replace uses of Module using Block with unique variables:

Applying the function replaces the Module local variables with unique variables:

Activate the code and the transformed code to make definitions for f and fb:

Compare values for random test values:

Compare timings for a large set of test values:

## Properties & Relations(4)

Inactive expressions can be created using Inactivate:

Inactive expressions can be evaluated using Activate:

Inactive creates inactive forms of symbols and allows parts of expressions to be inactive:

Hold maintains the expression in unevaluated form, and all parts are inactive:

Compare an inactive expression with the corresponding FullForm:

## Neat Examples(1)

Create a gallery of multivariate sums: