Mathematica Journal
Volume 9, Issue 1


In This Issue
Tricks of the Trade
In and Out
Trott's Corner
New Products
New Publications
News Bulletins
New Resources

Download This Issue 

About the journal
Editorial Policy
Back Issues
Contact Information

What's New in Mathematica 5
The Mathematica 5 Product Team

Symbolic Computations


The function DSolve can now find all rational solutions to systems of linear equations with rational coefficients. It can also solve linear systems of differential equations with constant coefficients.

Example: Linear System with Rational Function Coefficients

Here is a linear system with rational function coefficients that has a rational solution.

In addition, DSolve can solve some singular or differential-algebraic equations—in particular, systems of linear equations of the form, where the matrix A is singular:

Notice how the general solution to this differential-algebraic equation has only one general parameter even though it is a system of order two. Again, one degree of freedom is removed by having an algebraic equation between variables.

In this case you have the freedom to choose only one initial value freely.

This is the implied initial value of the last variable.


The function RSolve can solve systems of linear and nonlinear difference equations, difference-algebraic equations, and partial difference equations. It can also solve q-difference or divide-and-conquer equations.

Just as with differential equations, fairly innocent-looking difference equations can generate very complicated solutions, and ultimately there are not general-enough functions to express all solutions in closed form. In many cases, however, closed-form solutions can be found as in the following examples.

Example: Legendre Polynomials

RSolve recognizes the difference equation for Legendre polynomials.

Example: General and Particular Solutions to

This gives the general solution to involving one arbitrary constant .

This solves the difference equation and the initial value equation .

This shows that the solution satisfies the difference and the initial value equations.

Example: Second-Order Difference Equation with Boundary Conditions

This solves a second-order difference equation with two boundary conditions.

We can visualize the resulting sequence using a typical stem plot.

Example: Linear Second-Order Equation with Varying Coefficients

This example solves , a linear second-order, varying-coefficient equation.

Example: System of Difference-Algebraic Equations

This shows a linear system of difference-algebraic equations. Notice how this second-order system only has one general constant in its solution. This is because one degree of freedom has been removed by the algebraic equation.

This is the corresponding initial value problem with only one initial value given.

This is the resulting initial value for .

Example: Partial Difference Equations

Partial difference equations have several independent variables. In these cases the general solution is parameterized by general functions.

Here is a linear partial difference equation with a general arbitrary function .

Example: Divide-and-Conquer Equations

RSolve can also solve so-called q-difference equations or divide-and-conquer equations. These are equations of the form .

If you compare these to the normal difference equations, , you can see that the arguments to the dependent function form an arithmetic sequence for difference equations and a geometric sequence for q-difference equations. Hence, these are also often called arithmetic and geometric difference equations, respectively. Geometric difference equations often come up in the analysis of algorithms, combinatorics, and number theory.

This a first-order linear q-difference equation that gives the number of comparisons when doing a binary search.

This gives the arithmetic complexity for a fast Fourier transform operation.


The function Reduce has been extended to solve equations involving any combination of equalities, inequalities, existential quantifiers, universal quantifiers, and domain specifications.

Example: Solving over Different Domains

In this example we solve the equation over different domains. In all cases there are infinitely many solutions.

This solves a simple equation over the complexes.

This solves the same equation over the reals and requires inequalities to describe the solution.

Solving the same equation over the integers requires additional parameters to describe the solution. These equations are called Diophantine equations. The following example is a special form of a Diophantine equation called Pell’s equation.

This solves the equation over the integers modulo 12.

This solves the same equation over a domain of real and complex .

Example: Equations with Infinitely Many Roots

Reduce will generate complete solutions. Here is an example in which there are also infinitely many real roots.

Example: Equations Including Quantifiers

Another type of equation is one that includes quantifiers, such as the existential () and universal () quantifiers defined in Mathematica with Exists () and ForAll ().

This reduces the a and b values that make the quadratic polynomial positive for all real x.


The function Resolve can eliminate quantifiers from arbitrary polynomial systems in complex or real variables using the same methods used by the function Reduce. For cases in which obtaining an implicit quantifier-free form of the system is easier than computing explicit solutions, Resolve returns the implicit form. Resolve can also eliminate quantifiers involving Boolean variables.

Example: Real Coefficients

This gives the conditions that real coefficients have to satisfy so that a quadratic polynomial in a real variable is positive.

Example: Does Imply that ?

This tests whether implies that .

In this case we can visually check as well.


The new function FindInstance takes the same input as Reduce but gives, at most, the requested number of different solutions. FindInstance works for all problems Reduce can solve fully. For problems in which the complete solution is not needed, finding instances of solutions can be much faster than trying to find the whole solution set. FindInstance may also be able to find instances in some problems that Reduce cannot solve.

Example: Finding Real Solutions to

This example uses Reduce to find the general formula for all real solutions to .

FindInstance gives instances of real numbers that solve the above equation.


The functions Maximize and Minimize find the exact global maximum or minimum for a function over a region. They generally work with polynomial input; however, they can handle some transcendental inputs.

Example: Basic Geometrical Properties

Here Maximize shows that the rectangle with the maximal area for a given circumference is a square.

This gives the maximum volume of a cylinder where the surface area is .

Example: Unconstrained Problems

Minimize and Maximize yield lists giving the value attained at the minimum or maximum, as well as with rules specifying where the minimum or maximum occurs.

This finds the minimum of a quadratic function.

Applying the rule for x gives the value at the minimum.

This maximizes with respect to x and y.

Example: Constrained Problems

Minimize[expr, x] minimizes expr allowing x to range over all possible values from -∞ to +∞. Minimize[{expr, cons},x] minimizes expr subject to the constraints cons being satisfied. The constraints can consist of any combination of equations and inequalities.

This finds the minimum subject to the constraint x≥3.

This finds the maximum within the unit circle.

This finds the maximum within an ellipse. The result is fairly complicated.

This finds the maximum along a line.

Minimize and Maximize can solve any linear programming problem in which both the objective function expr and the constraints cons involve the variables x i linearly only.

Here is a typical linear programming problem.

In principle, Minimize and Maximize can also solve any polynomial programming problem in which the objective function and the constraints involve arbitrary polynomial functions of the variables. Many important geometrical and other problems can be formulated in this way.

This solves the simple geometrical problem of maximizing the area of a rectangle with fixed perimeter.

This finds the maximal volume of a cuboid that fits inside the unit sphere.

An important feature of Minimize and Maximize is that they always find global minima and maxima. Often functions will have various local minima and maxima at which derivatives vanish, but Minimize and Maximize use global methods to find absolute minima or maxima, not just local extrema.

Here is a function with many local maxima and minima.

Maximize finds the global maximum.

If you give functions that are unbounded, Minimize and Maximize will return - and + as the minima and maxima. If you give constraints that can never be satisfied, Minimize and Maximize will return + and - as the minima and maxima and Indeterminate as the values of variables.

One subtle issue is that Minimize and Maximize allow both nonstrict inequalities of the form xv, and strict ones of the form x < v. With nonstrict inequalities there is no problem with a minimum or maximum lying exactly on the boundary x -> v, but with strict inequalities a minimum or maximum must in principle be at least infinitesimally inside the boundary.

With a strict inequality Mathematica prints a warning and then returns the point on the boundary.

Minimize and Maximize normally assume that all variables you give are real. However, by giving a constraint such as x Integers, you can specify that a variable must in fact be an integer.

This does maximization only over integer values of x and y.


The new function Refine[expr, assum] gives the form of expr that would be obtained if symbols in it were replaced by explicit numerical expressions satisfying the assumptions assum.

Example: Simplifying a Square Root

The following refines , assuming that is positive.

If is also positive, simplifies to .

Example: Using Assumptions in Mathematica Functions

A number of Mathematica functions pick up assumptions, (e.g., Limit and Integrate).

The limit of depends on the domain of and .

Assumptions also propagate through multiple functions.

About Mathematica  Download Mathematica Player
Copyright © Wolfram Media, Inc. All rights reserved.