Declaration Objects

It's often the case when doing a calculation that you need to specify one or more properties of particular variable used in the calculation. For example, you may want to specify that certain variables are constants or that a variable is greater than zero. Declarations allow you to define these kinds of properties.

Any expression in a Document module that is of type Declaration is considered to be a declaration and is included in the declarations parameter that is pass into some of the commands.

Declarations are passed to commands anytime the command includes the Declarations command parameter.

An example of a declaration is

which indicates that a and b should be treated as constants. This is used in evaluating integrals and derivatives for example.

Declarations can be placed anywhere in a Document module. A declaration will be used throughout a module, independent of where it's located in the module.

You can also create you own declarations by creating an object with result type of Declaration. For example, the definition of the Define object is:

After creating a declaration, you need to modify one or more functions to look for the new declaration object and generate the appropriate results based on the value of the declaration.

For example, when acting on the absolute value object, the Simplify command looks for a Define that allows it to determine that the value inside the absolute value is defined to be greater than or equal to zero. When this is the case, the absolute value is discarded by the Simplify command.