Pünktlich zum 15-jährigen Firmenjubiläum von Wolfram Research erscheint Mathematica 5. Mit Mathematica 5 definiert Wolfram Research die Welt des Technical Computings neu.Bisher musste sich Mathematica in verschiedenen Bereichen der numerischen Berechnungen vor dedizierter Numeriksoftware in Punkto Geschwindigkeit zurückhalten.Mathematica 5 durchbricht die bisherigen Geschwindigkeitsgrenzen und setzt neue Massstäbe.Mathematica 5 kann damit selbst in industrietypischen Anwendungen eingesetzt werden und verliert nicht die bekannte Anwendungsvielfältigkeit.Geschwindigkeit,Skalierbarkeit und Einsatzbarkeit machen Mathematica 5 zum einzigartigen Technical Computing System zum flächendeckenden Einsatz.Mathematica 5 ist hauptsächlich ein Release für neu entwickelte und verbesserte Algorithmen,neu definierte Schlüsseltechnologien und dem Handling von großen Datenmengen.Neue und verbesserte numerische Algorithmen und Routinen ermöglichen Mathematica 5 so schnell oder schneller wie dedizierte numerische Software oder Bibliotheken zu sein.Zudem enthält es einen kompletten neuen Solver für numerische Differenzialgleichungen.Mit Mathematica 5 verfolgt Wolfram Research weiter seine Strategie zur Integration von Industriestandards und anderer Software.Zu den neuen Versionen von J/Link und MathLink,Mathematica´s Standardschnittstelle zu Java und C/C++ kommt ein voll funktionsfähiger Technologiepreview,der.NET/Link(TM),hinzu.Dieser wird es Entwicklern ermöglichen Mathematica in Anwendungen zu integrieren,die Microsoft´s.NET Technologie einsetzen wollen.

Schnellübersicht zu dem Mathematica 5 Features

Function - SetPath (path definition on your local machine)

\(\(SetPath[filename_String] := 
        Module[{pfad}, 
          pfad = ToString[
              Append[Append[
                  Drop[\(Extract["FileName" /. 
                          NotebookInformation[EvaluationNotebook[]], {1}, 
                        FrontEnd`FileName]\)[\([1]\)], 1], "newin5data"], 
                filename]]; 
If[
            StringTake[$OperatingSystem, 6] == "Window", 
            pfad = StringReplace[
                pfad, {" " -> "", "{" -> "", "}" -> "", "," -> "\"}]]; 
If[\(($OperatingSystem == "Unix")\) || \(($OperatingSystem == "MacOSX")\), 
            pfad = StringReplace[
                pfad, {" " -> "", "{" -> "/", "}" -> "", "," -> "/"}]]; 
If[$OperatingSystem == "MacOS", 
            pfad = StringReplace[
                pfad, {"{" -> "", "}" -> "", ", " -> ":"}]]; 
pfad];\)\)

Performance Enhancements

Key new technologies enable Mathematica 5 to outperform dedicated numerical systems in raw computational speed without compromising any of the accuracy or reliability that Mathematica is known for.

Fast Dense Numerical Linear Algebra

Dense numerical linear algebra is an important building block for most of Mathematica’s numerical analysis functionality, ranging from data analysis over matrix operations, to numerical differential equation solvers to graphics. The performance increases in Mathematica 5 affect basically every aspect of Mathematica. On modern microprocessors, Mathematica 5 now offers class-leading performance for these kinds of operations, operating on par with Fortran or MATLAB code.

Here are some examples of speedups between Mathematica 4.2 and Mathematica 5.

({{Operation, Mathematica 4.2, Mathematica 5, Speedup}, {Dot product 

          (1000 by 1000), 3.953 s, 0.625 s, 6.37}, {Solving a dense system of equations 

          (1000 by 1000), 3.235 s, 0.375 s, 8.62}, {Inverse 

          (1000 by 1000), 14.218` s, 1.0930000000000002` s, 13.01}, {Singular values 

          (500 by 500) , 3.8590000000000018`  
            s, 0.5940000000000003`  s, 6.49}})

Mathematica 5 also takes advantage of multiple processors for some numerical operations, such as dot product on operating systems such as Linux, Windows, and HP-UX support this multithreaded capability.

High-Speed Sparse Linear Algebra

A large number of real world problems deal with sparse matrices, that is, matrices in which most of the elements are zero. Examples of operations that involve sparse matrices include solving of ordinary and partial differential equations, optimization problems, and large-scale simulations. Mathematica 5’s implementation of sparse linear algebra is unique in that it allows for arrays of any dimension (or rank) and is fully integrated with the rest of the Mathematica system. The performance of basic sparse linear algebra operations is on par with, or better than, those in dedicated numerical systems.

Creating Sparse Arrays and Converting between Sparse and Dense Arrays

Adding the head SparseArray forces the creation of a sparse array object.

SparseArray[ {{i_,  j_} /;  
            Abs[i - j]  ≤  1  :>  
          Random[] },  {5,  5}]

Applying Normal to a sparse array object or using MatrixForm gives the corresponding dense array.

Normal[%]   // MatrixForm

Operations on Sparse Matrices

The sparse array data structure and the specialized sparse algorithms allow Mathematica users to do operations on very large matrices. The following matrix has (10^12)elements.

n = (10^6);

A  =  
      SparseArray[ {{i_,  j_}  /;  
              Abs[i - j] ≤ 1  :>  Random[]},  {n, 
          n}]

b  =  Table[ Random[],  {n}];

Notice the big difference in size between sparse and dense representation. The dense representation requires eight terabytes of memory for storage, while the sparse array object needs only a bit over 40 megabytes. 
Depending on your machine the calculations below will last for a minute or more.

sparseMemory  =  N[ ByteCount[ A ] ] Byte

denseMemory  =  N[ (10^6) (10^6) 8 ] Byte

Operations on sparse arrays are extremely fast. Notice that LinearSolve correctly detects that it has been given a sparse array object.

Timing[ LinearSolve[ A,  b ]; ]

We just solved an equation system with 1,000,000 equations and 1,000,000 variables. Taking the dot product of a large sparse matrix is also very fast.

Timing[ A . A; ]

Clear[n, A, b]

Large-Scale Linear Programming

Mathematica is now optimized for solving large-scale linear programming problems. It uses an efficient interior-point method. Similar functionality has until now been only available in expensive special-purpose packages.

Example: Solving a Standard Test Problem

The following Import command loads a standard linear programming test problem.

<< "Optimization`MPSData`"

p  =  
        Import[SetPath["80bau3b.mps"], "MPSData"];

{c,  A,  b,  d} = ToLinearProgrammingData[p];

The 80bau3b problem has about 2,000 constraints and about 10,000 variables.

Dimensions[ A ]

This solves the linear programming problem and returns the optimizing argument.

xo  =  
          LinearProgramming[ c,  A,  b,  d,  
            Method -> "InteriorPoint"]; // Timing

This is the optimal value.

c . xo

Clear[c, A, b, d, p]

This problem could not have been solved in Mathematica 4.2 because a dense form of the data would have been used.  The memory requirements and processing time for such an operation would have made the problem infeasible to solve.

Example: Solving Another Standard Test Problem

This is an example of solving a linear programming problem with 232,000 variables and 10,000 inequalities. The datas are provided in the zipped file "osa-60.zip". Unzipped it will have the size of about 50 MB, if you try to import it without haveing more then 500MB RAM it might results in conflicts.

{c, A, b, d} = 
        ToLinearProgrammingData[
          Import[SetPath["osa-60.mps"], "MPSData"]];

Dimensions[A]

AbsoluteTiming[
        Timing[xo  =  
              LinearProgramming[c,  A,  b,  d,  
                Method  ->  "InteriorPoint"]; ]]

As in the previous example, here is the optimal value.

c  .  xo

Clear[c, A, b, d]

Big-Number Arithmetic

Mathematica has been able to handle numbers with millions of digits for quite some time, but more-efficient implementations and better algorithms have improved the performance by a factor of up to three for numbers with less than one thousand digits. For numbers with millions of digits, performance improvements are even higher when an asymptotically more efficient algorithm is used. 
The big-number performance in Mathematica 5 is on par with, or faster than, the performance of special-purpose libraries and is unchallenged for general computation systems.

({{Operation , Mathematica 4.2, Mathematica 5, Speedup}, {\(Multiplying\ two\ 1000 - digit\ 

          \(\(real\)\(\ \)\(numbers\)\(\ \)\(10000\)\(\ \)\(times\)\(\ \)\)\), 0.797 s, 0.406 s, 1.96}, {Multiplying two integers 

          with 1000 digits 10000 times, 1.0 s, 0.407 s, 2.46}, {Computing the greatest common

          divisor of two integers with 

          100000 and 100 digits, 0.407 s, 0.047 s, 8.66}, {Calculating the square roots of 1000 

          
          1000 - digit real numbers , 0.359 s, 0.062 s, 5.79}})

64-Bit Platform Support

Mathematica 5 allows users, who are running increasingly larger computations and applications and find themselves limited by the 4-gigabyte address ceiling in 32-bit systems like the current Intel IA-32-bit architecture, to access nearly a million terabytes (1 terabyte = 1,024 gigabytes).

The combination of a 64-bit address space and fast numerics, part of Wolfram Researches gigaNumerics initiative, lets Mathematica users solve very large problems.

Mathematica 5 is optimized for a large number of 64-bit CPUs and operating systems, including Sun Solaris for UltraSPARC, HP-UX for PA-RISC, IBM AIX for the Power architecture, HP Tru64 Unix on Alpha, and Linux on Alpha. The two main benefits are the ability to solve vastly larger problems than on 32-bit platforms and speed increases for big-number arithmetic due to the 64-bit word length.

This 64-bit optimization will also let Mathematica users take full advantage of planned performance increases in future versions of these 64-bit processors.

Faster MathLink

MathLink uses TCP/IP devices for communications between parts of Mathematica, such as the front end and the kernel, as well as for the primary means of communication between multiple Mathematica kernels, such as in gridMathematica clusters.

A new TCP/IP protocol allows Mathematica 5 to communicate at the speed of the underlying network. On a standard 100Base-T network, bandwidth improves by a factor of 10 and latency by a factor of 200. On faster networks, such as Gigabit networks and crossbars found in leading-edge computing centers, the gains are even higher. Additional improvements—for example, a new SharedMemory protocol for Windows platforms—give additional 10-fold improvement for communication between parts of Mathematica on the same machine.

Because all MathLink bindings (J/Link, .NET/Link,  and almost all Import / Export formats) rely on MathLink, these will also improve as a result of improvements in MathLink.

Numeric Computations

Mathematica 5 brings major enhancements for numeric computations, including new-generation optimized numerical solvers for ordinary and partial differential equations, as well as extensive support for vector and array functions in numeric solvers.

NDSolve

The function NDSolve has been completely rewritten, resulting in better performance and much greater flexibility. While many of the enhancements are transparent and will benefit all users, the new NDSolve gives advanced users many more options for selecting methods, setting evaluation options, and monitoring the progress of the solver—and even ways for implementing their own custom solvers into NDSolve.

Some of the most significant improvements include:

• New additional solving methods including explicit RungeKutta methods, implicit Runge-Kutta methods of arbitrary order, Deuflhard arbitrary-order extrapolation methods, BDF-based methods, and double step
• More-efficient implementations leading to large speed increases for many types of differential equations
• NDSolve now supporting vector and array variables
• NDSolve now solving some differential-algebraic equations
• New options EvaluationMonitor and StepMonitor that allow monitoring of the solution progress and more fine-tuning of the solving procedure
• NDSolve providing a framework for inclusion of methods defined in the Mathematica language.

Example: Solving a System of Differential Equations

The following example demonstrates the use of vector variables to specify a system of differential equations of dimension 12.

To assist in the visualization of the results of the following numerical differential equation, it is useful to view the solution as a three-dimensional graphic.

IntrinsicCurve3D[ {κ_,  τ_}, {s_,  smin_,  
            smax_},  {s0_?NumericQ,  x0_?VectorQ,  t0_?VectorQ,  
            n0_?VectorQ},  
          opts___?OptionQ]  := 
Module[ {x,  t,  n,  
            b,  s,  c}, 
c  =  
            x /.  First @ 
NDSolve[
{
x'[s]  ==  
                      t[s],                                x[s0] ==  
                      x0, 
t'[
                        s]  ==  κ n[
                          s],                             t[s0] ==  
                      t0, 
n'[
                        s]  ==  τ b[s] -  κ t[
                            s],            n[
                        s0] ==   n0, 
b'[
                        s]  ==  -τ n[
                          s],                           b[s0] ==  Cross[ t0,  
                        n0]
}, 
{x,  
                    t,  n,  b},  
{s,  smin,  
                    smax}
]; 
ParametricPlot3D[c[s],  {s,  smin,  smax},  
            opts ]
];

IntrinsicCurve3D[ {κ_,  τ_},  {s_,  smin_,  
            smax_},  
          opts___?OptionQ ]  :=  
IntrinsicCurve3D[{κ,  τ},  {s,  smin,  
            smax},  {0,  {0, 0, 0},  {1, 0, 0},  {0, 1, 0}},  
          opts ];

The following example is of a space curve defined by curvature and torsion.

IntrinsicCurve3D[ {Abs[s],  0.3},  {s, -10,  10},  
        PlotPoints  ->  500 ];

Example: Solving a Matrix Differential Equation

In this example we solve the matrix differential equation X'(t)==A . X(t) with A=-(({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}})) and the initial condition X(0)==(({{1, 0, 0}, {0, 1, 0}, {0, 0, 1}})).

A  =  -{{1, 2, 3},  {4, 5, 6},  {7, 8, 9}};

matrixExpA  =  
      X  /.  First[ 
          NDSolve[ X'[t] ==  A  .  X[t]  ∧  
              X[0]  ==  IdentityMatrix[3],  
            X,  {t,  0,  5} ]]

We can define a particular matrix norm and look at the differences.

<< "Graphics`Graphics`"

LogListPlot[ 
        Table[ Norm[ 
            MatrixExp[ A,  t]  -  matrixExpA[ t ] ],  {t,   .2,  
            5,   .2}],  PlotJoined  ->  True];

Example: Solving a Differential-Algebraic Equation

In this case we have one differential equation x'[t] == x[t] + 2  y[t] and one explicit algebraic equation 0  ==  x[t]  +  y[t]. Notice how (in this case only) we give one initial value equation x[0] == 1. The initial value equation for y[0] is implicitly determined by the algebraic equation.

NDSolve[ x'[t] == x[t] + 2  y[t]  ∧   0  ==  
          x[t]  +  y[t]  ∧  x[0] == 1,  {x,  y},  {t, 0, 
        1}]

Plot[ 
        Evaluate[ {x[t],  y[t]}  /.  First[ % ] ],  {t,  0,  
          1}];

Example: Modeling an Exothermic Chemical Reactor

The following is an exothermal chemical reactor model. In this simple first-order isomerization process, the heat is removed through an external cooling circuit. In this case we have c product concentration, T product temperature, and R reaction rate. Furthermore, we have (Subscript[c, 0]) reactant concentration, (Subscript[T, 0]) reactant temperature, (Subscript[T, c]) cooling circuit temperature, and (Subscript[k, 1]), …,  (Subscript[k, 4]) constants.

<< "Graphics`Colors`"

results = 
      Block[ {k1 = 1,  k2 = 1,  k3 = 10,  k4 = 10,  c0 = 1,  T0 = 30,  
          Tc = 10}, 
NDSolve[
{
c'[t] ==  
              k1 (c0 - c[t]) - r[t], 
T'[
                t] == 
              k1 (T0 - T[t]) + k2 r[t] - 
                k3 (T[t] - Tc), 
0 == 
              r[t] - k3 Exp[-k4/T[t]] c[t], 
c[
                0] ==  c0,  
T[0] ==  
              T0
},  
{c,  T,  
            r}, 
{t,  0,  
            5}
]
]

Plot[ 
        Evaluate[ {c[t], T[t], r[t]} /. First[results]],  {t,  0, 5},  
        PlotStyle ->  {Red,  Green,  Blue}, Frame -> True, 
        FrameLabel -> {"Time", "c,T, and r"}];

Example: Solving a Partial Differential Equation

A soliton is a solitary wave that survives collisions with other solitary waves. Ocean waves are solitons, for example. The Korteweg-de Vries equation was the first differential equation describing a soliton. Technical applications of solitons include long-haul optical fiber transmission systems.

This is the Korteweg-de Vries equation in one spatial dimension.

KdV[{α_},  t_,  x_ ]  :=  
        D[ψ[t, x],  
              t]  +  α ψ[t, x] D[ψ[t, x],  x] + 
            D[ψ[t, x],  {x, 3}] == 0;

This is a solitary wave solution to the KdV equation above.

S[{α_,  c0_,  x0_}, t_,  
          x_ ]  :=  ((3 c0)/α) (((Sech[ ((Sqrt[c0])/2) (x - x0 - c0 t)]))^2);

Because we are going to use periodic boundary conditions, we will add up all the period contributions to get the following initial condition.

Φ = 
        S[{1, 3, 5}, 0,  x]  + 
          S[{1, 3/2, 15}, 0,  x] + 
S[{1, 3, 5 + 40}, 0,  
            x]  + S[{1, 3/2, 15 + 40}, 0,  
            x] + 
S[{1, 3, 5 - 40}, 0,  x]  + 
          S[{1, 3/2, 15 - 40}, 0,  x];

(Φ  /.  
          x -> 0. )  ==  (Φ  /.  
          x -> 40. )

Here we can see how these solitary waves interact.

s = 
          NDSolve[ 
            KdV[{1},  t,  
                x]  &&  ψ[0, x] ==  Φ  &&  ψ[
                  t, 0] ==  ψ[t, 40],  ψ,  {t, 0,  
              10},  {x,  0,  40},  
            Method -> StiffnessSwitching];  // Timing

Plot3D[ 
        Evaluate[ ψ[t, x]  /.  First[ s ]],  {x,  0,  
          40},  {t,  0,  10},  PlotRange  ->  {0,  10},  
        PlotPoints  ->  100,  Mesh  ->  False];

Notice the nonlinear interaction when they pass each other.

Show[ %,  
        ViewPoint -> {-1.855,  -1.725,  4.000}];

FindRoot

The function FindRoot now supports general array variables and includes new and improved algorithms that lead to speed increases and better handling of large-scale problems on computers with limited memory.

Example: Solving a Matrix Riccati Equation

Here is an example of solving a matrix equation—in this case a continuous-time algebraic Riccati equation  Q + (A^T) P + P A - 
          P B (R^(-1)) (B^T) P == 0.

Suppose we have a system (e.g., a double integrator, or some type of mechanical system) and constraints.

A  =  {{0, 1},  {0, 0}};  B  =  {{0},  {1}};

Q  =  {{1, 0},  {0, 1}};  R  =  {{1}};

This finds a matrix root to the equation Q + (A^T) P + P A - 
          P B (R^(-1)) (B^T) P == 0.

FindRoot[ 
      Transpose[A]  .  P  +  P  .  A  -  
          P  .  B  .  Inverse[R]  .  Transpose[B] . P  == - 
          Q, 
{P,  {{10,  2},  {2,  10}}}]

FindFit

The new function FindFit supersedes and extends the functionality of the functions Fit and NonlinearFit. FindFit supports array variables, provides more methods, and can use the functions StepMonitor and EvaluationMonitor for keeping track of the process.

Example: Fitting Data

FindFit can even fit data using a piecewise continuous function.

data = 
        Table[{t, 
            Which[t < 0, 0, 
              True, (E^(-0.04 t)) Sin[
                  0.1 t]]}, {t, -10, 50}];
model = 
        Which[t < 0, 0, 
          True, (E^(-a t)) Sin[b t]];
sol = FindFit[data, model, {{a, 0.02}, {b, 0.3}}, {t}]

The data can be shown with the following fitting function.

Show[
        ListPlot[data,  PlotJoined -> False,  
          PlotStyle -> {PointSize[0.015],  Hue[0.6]}, 
          DisplayFunction -> Identity], 
Plot[
          model /. sol,  {t,  -10,  50}, 
          DisplayFunction -> 
            Identity], 
DisplayFunction -> $DisplayFunction];

Example: Fitting a Circle

Suppose we are taking measurements along a circle.

data  =  
        Table[ {Cos[t]  +  5,  Sin[t]  +  15,  0. } + 
            Random[Real, {- .05, 0.05}],  {t,  0. ,  2  Pi,  
            0.01}];

<< "Graphics`Colors`"

dg  =  
        ListPlot[ Take[ data,  All,  2], Frame -> True,  
          PlotStyle  ->  Red ,  
          AspectRatio -> Automatic];

This fits a circle with radius R and center {x0,y0} to the data.

Clear[R]

s = 
      FindFit[ data,  (((x - x0))^2) + (((y - y0))^2) - (R^2),  {x0,  
          y0,  R},  {x, y} ]

fg = 
        Show[Graphics[{RGBColor[0, 0, 1], 
              Circle[{x0 /. s, y0 /. s}, R /. s]}], 
          DisplayFunction -> Identity];

This shows the data and the fitted circle together.

Show[ {dg,  fg},  AspectRatio  -> Automatic];

FindMinimum and FindMaximum

The new function FindMaximum has been added for convenience. The functions FindMinimum and FindMaximum now support general array variables, offer new and improved algorithms, and work better in limited-memory situations. Note: The package NMinimize and the function FindMinimum was introduced in  Mathematica 4.2

Example: Computing a Matrix Norm

In this case we are using a vector variable.

A  =  {{1, 2},  {3, 4}};

FindMaximum[ Norm[A . x,  4]/Norm[x, 4],  {x,  {1, 1}}]

Symbolic Computations

Mathematica 5 introduces extensive new symbolic functionality, much of which is based on algorithms that are exclusive to Mathematica. Some highlights include major new algorithms for solving equations and inequalities symbolically over complex numbers, reals, and integers; solvers for differental algebraic equations and recurrence equations; and wider support for user-defined domain specifications.

DSolve

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.

DSolve[ 
{ 
u'[t]==(((6 + 2 t - 3 (t^3) - (t^5)) u[t])/(t (-3 - 2 t + (t^2)) (-1 + (t^3)))) + (((5 + t) v[t])/((-3 - 2 t + (t^2)) (-1 + (t^3)))),
v'[t]==-((4 t (-3 - 2 t + (t^2)) u[
                          t])/((5 + t) (-1 + 
                            (t^3)))) + (((1 + 20 (t^2) + 3 (t^3)) v[t])/((5 + t) (-1 + (t^3))))
},
{u,  v}, 
t
]

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.

DSolve[ x'[t] == x[t] + 2  y[t]  ∧   0  ==  
          x[t]  +  y[t] ,  {x,  y},  t]

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

DSolve[ x'[t] == x[t] + 2  y[t]  ∧   0  ==  
          x[t]  +  y[t]  ∧  x[0] == 1,  {x,  y},  
      t]

This is the implied initial value of the last variable.

y[0]  /.  First[ % ]

RSolve

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.

\(RSolve[
        u[x]\  - \ \((\((3\  + \ 2*x)\)*\((d\  + \ c*z)\)*
                  u[1\  + \ x])\)/\((1\  + \ x)\)\  + \ 
\((\((2\  + \ x)\)*
                  u[2\  + \ x])\)/\((1\  + \ x)\)\  == \ 0, \ u, \ x]\)

Example: General and Particular Solutions to (Subscript[y, k + 1]) ==  (k + 1) (Subscript[y, k])

This gives the general solution to (Subscript[y, k + 1]) ==  (k + 1) (Subscript[y, k]) involving one arbitrary constant C[1].

RSolve[ y[k + 1] ==  (k + 1) y[k],  y,  k ]

This solves the difference equation (Subscript[y, k + 1]) ==  (k + 1) (Subscript[y, k]) and the initial value equation (Subscript[y, 0]) == 1.

RSolve[ 
      y[k + 1] ==  (k + 1) y[k]  &&  y[0] == 1,  y,  
      k ]

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

y[k + 1] ==  (k + 1) y[k]  &&  y[0] == 1 /. % // 
      FullSimplify

Example: Second-Order Difference Equation with Boundary Conditions

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

s  =  
      RSolve[ y[k + 2]  +  2 y[k + 1]  +  y[k]  ==  0  &&  
          y[0]  ==  1  &&  y[1]  ==  2,  y,  
        k ]

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

<<  Graphics`MultipleListPlot`

MultipleListPlot[ 
        Table[ Evaluate[ {k,  y[k]  /.  First[ s ]}],  {k,  0,  
            10} ],  SymbolShape  ->  Stem ];

Example: Linear Second-Order Equation with Varying Coefficients

This example solves y(n) (n^2) + ((n^2) + 1) y(n + 1) + 
          y(n + 2) = 0, a  linear second-order, varying-coefficient equation.

RSolve[ 
      y[n + 2]  +  (n^2  +  1) y[n + 1]  +  n^2 y[n] == 
        0,  y,  n ]

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 because one degree of freedom has been removed by the algebraic equation.

RSolve[ 
      x[k + 1] == x[k] + 2  y[k]  ∧   0  ==  
          x[k]  +  y[k],  {x,  y},  k]

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

RSolve[ 
      x[k + 1] == x[k] + 2  y[k]  ∧   0  ==  
          x[k]  +  y[k] ∧  x[0] == 1,  {x,  y},  
      k]

This is the resulting initial value for y.

y[0]  /.  First[% ]

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 C[1][l  - k].

RSolve[ u[k + 1,  l + 1] ==  a u[k, l],  
      u,  {k, l}]

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 F[k,  y[k],  y[q k],  …,  y[(q^n) k] ]  ==  
        0.

If you compare these to the normal difference equations, F[k,  y[k],  y[k + 1],  …,  y[k + n]]  == 0, you can see that the arguments to the dependent function y 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 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.

RSolve[b[n] == b[n/2] + 1  &&  b[1] == 1, b, 
      n]

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

RSolve[f[n] == 2 f[n/2] + (3/2) n, f, n]

Reduce

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

Example: Solving (x^2)-2  (y^2)=1 over Different Domains

In this example we solve the equation (x^2) - 2  (y^2) = 1 over different domains. In all cases there are infinitely many solutions.

This solves a simple equation over the complexes.

Reduce[ (x^2) - 2 (y^2) == 1,  {x, y},  Complexes ]

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

Reduce[ (x^2) - 2  (y^2) == 1,  {x, y},  Reals ]

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.

Reduce[ (x^2) -  2 (y^2) == 1,  {x, y},  
      Integers ]

This solves the equation over the integers modulo 12.

Reduce[ (x^2) -  2 (y^2) == 1,  {x, y},  
      Modulus  ->  12 ]

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

Reduce[ 
      (x^2) - 2  (y^2) == 1  &&  x ∈ Reals  &&  
        y ∈ Complexes,  {x, y} ]

Example: Equations with Infinitely Many Roots

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

Reduce[ 
      Tan[2  x]^2 + Cot[2  x]^2 +  2  Tan[2  x] + 2  Cot[2  x] == 
          6  &&  x ∈ Reals,  x ]

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.

Reduce[ 
      ForAll[ x,  x ∈ Reals,  
        (x^2) +  a x  +  b ≥ 0 ],  {a, b},  
      Reals ]

Resolve

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 a, b,  and c have to satisfy so that a quadratic polynomial in a real variable x  is positive.

Resolve[ 
      ForAll[x,  {x, a,  b,  c} ∈ Reals,  
        c (x^2) +  b x  +  a  > 0] ]

Example: Does (x^2) + (y^2) < 1 Imply that y > (x^4) - 2?

This tests whether (x^2) + (y^2) < 1 implies that y > (x^4) - 2.

\(Resolve[\ ∀ \_{x, y}Implies[x\^2 + y\^2 < 1, 
          y > x\^4 - 2]\ ]\)

In this case we can visually check as well.

<< "Graphics`InequalityGraphics`"

A  =  
        InequalityPlot[ 
          (x^2) + (y^2) < 
            1,  {x},  {y}, 
PlotRange -> {{-2,  
                2},  {-2,  
                2}},  
Fills ->  {{{1, 2},  
                RGBColor[1, 0, 
                  0]}},  
DisplayFunction -> 
            Identity];

B  =  
        InequalityPlot[ 
          y > (x^4) - 2,  {x,  -2,  2},  {y,  -2,  
            2},  
PlotRange -> {{-2,  
                2},  {-2,  
                2}},  
DisplayFunction -> 
            Identity ];

Show[ {B,  A},  
        DisplayFunction  ->  $DisplayFunction ];

FindInstance

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 (x^2) - 2  (y^2) == 1

This example uses Reduce to find the general formula for all real solutions to (x^2) - 2  (y^2) = 1.

Reduce[ (x^2) - 2  (y^2) == 1,  {x, y},  Reals ]

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

FindInstance[ (x^2) - 2  (y^2) == 1,  {x, y},  Reals,  
      3]

Maximize/Minimize

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

This loads the package Graphics`ImplicitPlot`.

<< Graphics`ImplicitPlot`;

Here is a curve.

curve = 
        ImplicitPlot[(x^2) + (y^3) == 1, {x, -3, 3}, 
          PlotStyle -> RGBColor[1, 0, 0]];

This finds the radius of the smallest circle centered at 0 containing the upper half-plane part of the curve.

rr = Maximize[(Sqrt[(x^2) + (y^2)]), 
          (x^2) + (y^3) == 1 && y > 0, {x, y}][[1]]

Show[{curve, 
          Graphics[{{RGBColor[0, 0, 1], Circle[{0, 0}, rr]}}]}];

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.

Minimize[x^2 - 3x + 6, x]

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

x^2 - 3x + 6 /. Last[%]

This maximizes with respect to x and y.

Maximize[5 x y - x^4 - y^4, {x, 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.

Minimize[{x^2 - 3x + 6, x >= 3}, x]

This finds the maximum within the unit circle.

Maximize[{5 x y - x^4 - y^4, x^2 + y^2 <= 1}, {x, y}]

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

Maximize[{5 x y - x^4 - y^4, x^2 + 2y^2 <= 1}, {x, y}]

If you would like to see the numerical value use teh function N

N[%]

This finds the maximum along a line.

Maximize[{5 x y - x^4 - y^4, x + y == 1}, {x, y}]

Minimize and Maximize can solve any linear programming problem in which both the objective function expr and the constraints cons involve the variables (Subscript["x", i]) linearly only.

Here is a typical linear programming problem.

Minimize[{x + 3 y, x - 3 y <= 7 && x + 2y >= 10}, {x, y}]

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.

Maximize[{x y, x + y == 1}, {x, y}]

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

Maximize[{8 x y z, x^2 + y^2 + z^2 <= 1}, {x, y, z}]

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.

Plot[x + 2 Sin[x], {x, -10, 10}]

Maximize finds the global maximum.

Maximize[{x + 2 Sin[x], -10 <= x <= 10}, x]

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 x ≤ v, 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[{x^2 - 3x + 6, x > 3}, x]

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.

Maximize[{x y, x^2 + y^2 < 120 && (x | y) ∈ Integers}, {x, y}]

Assuming/Refine

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

e = (Sqrt[x (y^2) (z^4)])

The following refines e, assuming that x is positive.

Refine[e,  x > 0]

If y is also positive, (Sqrt[(y^2)])simplifies to y.

Refine[e,  x > 0  &&  y  >  0]

Clear[e]

Example: Using Assumptions in Mathematica Functions

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

The limit of (x^α) depends on the domain of α and x.

Limit[ (x^α),  x -> ∞,  
      Assumptions ->  α > 0 ]

Limit[ (x^α),  x -> ∞,  
      Assumptions ->  α < 0 ]

Assumptions also propagate through multiple functions.

Assuming[ σ > 
        0, 
F  =  (∫_(-∞)^y) 
                (1/((Sqrt[2 π]) σ)) 
            Exp[-((((x - μ))^2)/(2 (σ^2)))] \[DifferentialD]x; 
Limit[ F,  
        y -> ∞]
]

Import, Export & Connectivity

New import and export filters, as well as updated Java, .NET, and XML integration make Mathematica 5 the technical software leader for communicating and embedding with other systems.

Connection Technology

.NET/Link Technology Preview

The included .NET/Link technology preview provides full integration with Microsoft’s .NET Framework. Mathematica users can load any .NET object into Mathematica and extend it. .NET/Link also provides an easy way to call any DLL or COM object from within Mathematica.

Import/Export

A number of graphic, web, and matrix file formats have been added to Mathematica 5, bringing the list of supported formats to over 40.

Example: XHTML with CSS

XHTML with CSS allows Mathematica users to preserve the look of their Mathematica notebooks much more closely when exporting them to the web. The following notebook expression creates a simple notebook in the Classroom style sheet.

nb  =  
        Notebook[{Cell["Heading", "Title"], 
            Cell["Section 1", "Section"], 
            Cell["Some text in the middle.", "Text"], 
            Cell["Section 2", "Section"]}, 
          StyleDefinitions -> "Classroom.nb"];

This is what the notebook looks like in Mathematica.

NotebookPut[nb];

This is the same notebook saved as an XHTML file.

Export[SetPath["document.htm"],  nb];

If you view this file in a web browser, you should see that the look simulates the look inside Mathematica.

Example: SVG

Mathematica 5 supports export to Scalable Vector Graphics (SVG), a language for describing two-dimensional vector and mixed vector/raster graphics in XML. SVG can be viewed with SVG viewers and web browsers with SVG plug-ins.

This defines a red disk in Mathematica graphics.

g  =  
        Show[ Graphics[ { RGBColor[1, 0, 0],  Disk[ {0, 0},  1 ] },  
            AspectRatio -> Automatic ] ];

This exports the SVG to a file ready to view with SVG viewers and web browsers with plug-ins.

Export[ "g.svg",  g ];

!! g.svg

Example: PNG

Mathematica 5 supports the Portable Network Graphics (PNG) format, a popular bitmap format for the web.

owl = Import[SetPath["lifeclock.png"]];

Show[owl];

Example: DICOM

Mathematica 5 supports the Digital Imaging and Communications in Medicine (DICOM) Standard. The DICOM Standard facilitates interoperability of medical-imaging equipment and is widely used in radiology.

This imports an image scanned using an MRI scanner.

g  =  
        Import[SetPath[ "MR-MONO2-16-knee"],  "DICOM"];

Show[ g ];

Example: Sparse Arrays

Mathematica 5 supports import and export of files in many standard sparse array formats such as Matrix Market and Harwell-Boeing.

s  =  
      Import[ SetPath["young1c.mtx"],  "MatrixMarket" ]

The new function MatrixPlot can show the structure of the nonzero elements in a sparse array.

<< "LinearAlgebra`MatrixManipulation`"

MatrixPlot[ s ];

Example: Tabular Import/Export

Many Mathematica users are processing increasingly large data sets. Import and export of tabular data has been speeded up by a factor between 10 and 100, depending on the size and structure of the data.

data1 = Table[Random[], {5000}, {10}];

Export[ SetPath["data.dat"],  
        data1,  "Table" ];

AbsoluteTiming[ data2  =  
          Import[  SetPath["data.dat"],  "Table" ];]

data1  ===  data2

Clear[data1 ,  data2]

In Mathematica 4.2, the preceding took about 16 seconds on the same computer (Pentium IV 2GHz:)

Import 16.2 Sekunden

Import 1.3 Sekunden

Other Functions

The range of other new capabilities in Mathematica 5 demonstrates its breadth and depth. From additional language constructs to enhanced statistical plots and improved publishing tools, new functionality has been added to every major aspect of the system.

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.

<< "Statistics`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.

Generate some numbers to plot.

dat = Table[Random[], {50}];
anotherdat = Table[Random[], {50}, {3}];

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

BoxWhiskerPlot[dat];

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

BoxWhiskerPlot[anotherdat];

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.

ParetoPlot[{a, b, c, d, d, d, e, d, e, e, f, a, b, c}];

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.

ParetoPlot[{{"Oats", 34.3}, {"Wheat", 72.1}, {"Rye", 
            10.2}, {"Soy", 68.2}}];

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.

QuantilePlot[Table[Random[], {300}], Table[Random[], {300}], 
        SymbolShape -> None, PlotJoined -> True, 
        ReferenceLineStyle -> {Hue[0], Dashing[{0.02}]}];

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.

dat = Table[{x, Sin[x], Cos[x]}, {x, 0, 2 π, 0.1}];

PairwiseScatterPlot[dat, DataSpacing -> 0.1, 
        PlotStyle -> {{GrayLevel[0], GrayLevel[0.7]}, {GrayLevel[0.4], 
              GrayLevel[0.9]}}, 
        DataRanges -> {All, All, {-0.75, 1}}, 
        DataLabels -> {"Line", "Sin", "Cos"}, 
        AspectRatio -> 0.5];

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.

dcount[n_Integer, digit_Integer, base_Integer] := 
      First@First[
          Reap[Apply[Plus, 
              Last[Reap[Sow[1, IntegerDigits[n, base]], 
                  digit, #2 &]], {1, -1}]]]

dcount[28093440230911048, 9, 10]

Example: StepMonitor and EvaluationMonitor

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

{yl, tl}  =  
      Reap[ NDSolve[ y''[t] == -y[t]  &&  
            y[0] == 0  &&  y'[0] == 1,  
          y,  {t,  0, 3  π},  
          StepMonitor  :>  Sow[t]] ]

yf  =  y  /.  First[yl]; 
s  =  Map[ {#,  yf[#]} &,  First[ tl ]];

This visualizes the steps used by NDSolve.

<< Graphics`MultipleListPlot`

g1  =  
        MultipleListPlot[ s,  SymbolShape  ->  Stem ];

This uses EvaluationMonitor to visualize the sampling used by NIntegrate.

{yl, tl}  =  
      Reap[ NIntegrate[ Sin[t], {t,  0,  3  π}, 
          EvaluationMonitor  :>  Sow[t]] ]

MultipleListPlot[ Map[ {#,  Sin[#]} &,  First[ tl ] ],  
        SymbolShape  ->  Stem ];

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.

<< Optimization`MPSData`

krnltime = 
      Timing[Import[
            SetPath["80bau3b.mps"], "MPSData"];]

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

walltime = 
      AbsoluteTiming[Import[
            SetPath["80bau3b.mps"], "MPSData"];]

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.

latency = First@walltime - First@krnltime

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.

tbl = Table[Random[], {100000}];

Norm[Table[Random[], {100000}], 2] // Timing

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

Norm[{a, b, c}, p]

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

Norm[{{a, b}, {c, d}}, 1]

Norm[{{a, b}, {c, d}}, Infinity]

Norm[{{a, b}, {c, d}}, Frobenius]

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  (({{1, 2}, {3, 4}})).

\(TraditionalForm\`‖A‖ = max\+\(x ≠ 0\)‖A‖\/‖x‖\)

A = {{1, 2}, {3, 4}};
FindMaximum[Norm[A . x, 2]/Norm[x, 2], {x, {0.001, 0.001}}]

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.

<< "NumberTheory`AlgebraicNumberFields`"

Algebraic objects are now supported.

a = Algebraic[#(1^3) - #1 + 1 &, {1, 2, 3}, 1]

Algebraic objects can be used in other functions as well.

N[a, 20]

Arithmetic can also be carried out with algebraic objects.

a = Algebraic[#(1^4) + 7 #1 - 21 &, {1, 2, 3, 4}, 1];
b = Algebraic[#(1^4) + 7 #1 - 21 &, {9, 8, 7, 5}, 1];
((2 (a^2) - 3 a b + 5 (b^5) - 3)/((a^8) - (b^4) + (1/2))) + 
      9

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

ToCommonField[{(Sqrt[2]), (Sqrt[3])}]

Arithmetic within a fixed finite extension of rationals is much faster than arithmetic within the field of all complex algebraic numbers.  For example, let’s define the following quantities.

{a, b, c} = {I, (Sqrt[2]), 
          Root[#(1^3) - 2 #1 + 3 &, 1]};
f = ((-2 y z (7 + x - y + (z^2)) + (6 + (x^2) + 2 y) (-11 + x y + (z^2)))/(2 y z (-4 - x + 3 y z) - (6 + (x^2) + 2 y) (2 - 2 x + (z^3))));

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. {(Subscript[a, 1]), …,  (Subscript[a, n])} is an integral basis of an algebraic number field K iff  (Subscript[a, i]) ϵ K are algebraic integers and every algebraic integer z ϵ K can be uniquely represented as z = (Subscript[k, 1]) (Subscript[a, 1]) + … + (Subscript[k, n]) (Subscript[a, n])with integer coefficients (Subscript[k, i]).

This gives an integral basis of the field generated by the first root of 533 + 429 #1 + 18 #(1^2) + #(1^3) &.

IntegralBasis[533 + 429 #1 + 18 #(1^2) + #(1^3) &,  1]

The discriminant of a number field K is the discriminant of an integral basis {(Subscript[a, 1]), …,  (Subscript[a, n])} of K (i.e., the determinant of the matrix with elements NumberFieldTrace[(Subscript[a, i]) (Subscript[a, j])]). The value of the determinant does not depend on the choice of integral basis.

Here is the discriminant of Q(2 - (Sqrt[3]) + (5^(1/4))).

NumberFieldDiscriminant[2 - (Sqrt[3]) + (5^(1/4))]

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.