Symbolics > Working with Symbolics > Working with Variables > Example: Explicit Calculation
  
Example: Explicit Calculation
Keyword explicit
Use the keyword explicit in symbolic calculations to return expressions with the values of variables in place, but without reducing numerical expressions.
1. Define some variables with units:
Click to copy this expression
Click to copy this expression
Click to copy this expression
2. Use the keyword explicit to substitute a variable for its value in the following expression:
Click to copy this expression
3. Evaluate the expression numerically:
Click to copy this expression
4. Change the units of the final result to miles per hour:
Click to copy this expression
Excluding Substitutions
The keyword explicit has modifiers that allow you to specify which variables receive substitution if assigned:
1. Substitute a single variable:
Click to copy this expression
2. Show that explicit substitutes only the assigned variables:
Click to copy this expression
Variable d is ignored because it is not part of the expression.
3. Show that using the ALL modifier has the same effect as specifying all variables:
Click to copy this expression
4. Show that using no modifiers has the same effect as redefining variable names before other types of symbolic calculations:
Click to copy this expression
5. To perform the above numeric calculation without using explicit, use the clear.sym function to clear the symbolic values of all variables:
Click to copy this expression
Click to copy this expression
6. Use explicit to display formulas in terms of variables, without substituting values for the variables defined elsewhere in the worksheet:
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Chaining Evaluations
Use the keyword explicit and its modifiers chained with other symbolic keywords and evaluations, just as you do with other symbolic operations. The settings persist throughout the calculation.
1. Use the keywords explicit and float in a chained symbolic evaluation:
Click to copy this expression
The result contains no numerical substitutions because all three variables were symbolically cleared in a previous step.
2. Redefine the three variables, and then repeat the above calculation:
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
3. Stack the keywords explict and float over a single symbolic evaluation operator:
Click to copy this expression
The stacking of keywords and modifiers can, in some cases, yield a different result.
4. Assign the symbolic result to a variable then evaluate the variable numerically:
Click to copy this expression
Click to copy this expression
5. Show that the numerical result remains unchanged when you specify different variables after explicit:
Click to copy this expression
Explicit calculation is used to revert to the named value of variables in symbolic computations without redefining the variables. Once the value has been masked, you can proceed with a multi-step symbolic or symbolic/numeric computation while treating some variables as names and some as their numeric assignments.
Substituting Values Dependent on Previous Values
You can chain definitions, but you have to include the whole sequence of variables to substitute all values.
1. Define some variables:
Click to copy this expression
Click to copy this expression
Click to copy this expression
2. Use the keyword explicit to substitute for a specified variable:
Click to copy this expression
Click to copy this expression
3. Make the value of c show up as a single number by symbolically evaluating it in its definition:
Click to copy this expression
Click to copy this expression
4. Add a square root to the definition of variable d:
Click to copy this expression
Click to copy this expression
5. Replace the square root of c with a numeric value by choosing different symbolic representation for d:
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression