The 
Mathematica Journal
Volume 9, Issue 1

Search

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

Download This Issue 

About the journal
Editorial Policy
Staff
Submissions
Subscriptions
Advertising
Back Issues
Contact Information

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

Other Functions

Statistical Plots

The new standard package StatisticsPlots offers a variety of plots and charts, including box-and-whisker plots, Pareto plots, and quantile-quantile plots, that are commonly used to gain an overview of data from a statistical perspective.

Example: Box-and-Whisker Plots

This loads the package StatisticsPlots.

The box-and-whisker plot is invaluable for gaining a quick overview of the extent of a numeric data set. It takes the form of a box that spans the distance between two quantiles surrounding the median, typically the 25% quantile to the 75% quantile. Commonly, "whiskers," lines that extend to span either the full data set or the data set excluding outliers, are added. Outliers are defined as points beyond 3/2 the interquantile range from the edge of the box; far outliers are points beyond three times the interquantile range.

This generates some numbers to plot.

In its most basic form the function takes a simple vector of data.

When the data is multivariate, a box is produced for each column.

Example: Pareto Plots

The Pareto plot is a quality-control plot that combines a bar chart displaying percentages of categories in the data with a line plot showing cumulative percentages of the categories.

In the most basic form, ParetoPlot takes a list of data that is assumed to consist of discrete categories. It determines the frequency of each category in the list, converts the frequencies to percentages, and creates the plot.

In data where the frequencies are precomputed, we can plot it directly by providing {category, frequency} pairs instead of the raw data to ParetoPlot.

The data quantities have been precomputed for this Pareto plot.

Example: Quantile-Quantile Plots

Quantile-quantile plots are used to determine whether two data sets come from populations with a common distribution. If the points of the plot, which are formed from the quantiles of the data, are roughly on a line with a slope of 1, then the distributions are the same.

Here two data sets are compared. Because they have identical distributions, the plot falls roughly along the reference line.

Example: Pairwise Scatter Plots

The pairs or matrix scatter plot allows the individual columns in a multivariate set of data to be plotted against each other in order to investigate relationships between the variables. The resulting plot is a matrix of subgraphs.

The following creates a simple data set and plots it with some options.

Sow and Reap

The functions Sow and Reap can be used together to accumulate lists of intermediate results in an evaluation.

Example: Mathematica's Function DigitCount

In this example, Sow and Reap are used to determine the number of times the digit 9 appears in the base-10 representation of a specified integer. The Mathematica function DigitCount works in a very similar way.

Example: StepMonitor and EvaluationMonitor

Here we accumulate the steps taken by NDSolve for an initial value problem.

This visualizes the steps used by NDSolve.

This uses EvaluationMonitor to visualize the sampling used by NIntegrate.

Timing Functions

The Mathematica function Timing calculates the amount of CPU time the kernel spends on a calculation. It does not take into account latency or other applications running on the CPU. The function AbsoluteTiming provides a type of "wall-clock timing" that measures the total time a command takes until the result is displayed.

Example: Importing a Large Data Set

Timing gives only the time spent by the Mathematica kernel.

Because Import uses MathLink to connect the kernel to an external converter, the total time for reading this data set is much longer.

The time spent in the external converter and in transferring the data between the converter and the Mathematica kernel plus the operating system spends doing something else, is the difference between the Timing and AbsoluteTiming results.

New Linear Algebra Functions

Mathematica 5 introduces new functionality in the area of linear algebra including generalized eigenvalues, matrix norms, Cholesky decomposition, new singular value operations, characteristic polynomials, and matrix rank.

Example: Norm

The new function Norm has been optimized to be fast for machine numbers. Here the 2-norm of a vector of length 100,000 is calculated.

Norm can also be used on symbolic vectors. Here the p-norm of a symbolic vector is determined.

Here is an expanded version of the above example. In the following, various p-norms of the same symbolic matrix are determined.

Here, Norm is used to further restrict the definition of itself, and the following definition of the matrix norm is used to obtain the norm of the matrix .

Algebraic Number Objects

Mathematica 5 brings high-performance arithmetic for algebraic numbers. Mathematica 5 represents algebraic numbers as Root objects. A Root object contains the minimal polynomial of the algebraic number and the root number, an integer indicating which of the roots of the minimal polynomial the Root object represents.

This loads the package AlgebraicNumberFields.

Algebraic objects are now supported.

Algebraic objects can be used in other functions as well.

Arithmetic can also be carried out with algebraic objects.

The function ToCommonField can be used to find a common finite extension of rationals containing the given algebraic numbers.

Arithmetic within a fixed finite extension of rationals is much faster than arithmetic within the field of all complex algebraic numbers. Here are some definitions.

An integral basis of an algebraic number field K is a list of algebraic numbers forming a basis of the -module of algebraic integers of K. is an integral basis of an algebraic number field K iff K are algebraic integers and every algebraic integer z K can be uniquely represented as z = k1 a1+ ... + knanwith integer coefficients ki.

This gives an integral basis of the field generated by the first root of .

The discriminant of a number field K is the discriminant of an integral basis of K (i.e., the determinant of the matrix with elements ). The value of the determinant does not depend on the choice of integral basis.

Here is the discriminant of Q.

Authoring and Presentation

AuthorTools, first introduced in Mathematica 4.2, has been expanded and now includes tools for operations such as comparing differences between notebooks.

Mathematica 5 also adds a new authoring palette for slide shows and an improved slide show environment for all style sheets.



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