The New Era of
Mathematica 
Technology

Tom Wickham-Jones
Director of Kernel Technology
Wolfram Research

This Talk

Show some of the new features of Mathematica 6



Fit into the context of Mathematica 



Point to most unique and interesting features of Mathematica

Mathematica

Environment for high-performance technical computing

Flexible programming language

Vast collection of algorithms

Tools for 
  visualization, data and statistical processing, 
  document preparation, user interface construction
   
Used by 
  scientists, engineers, mathematicians, 
  financial analysts, and educators

Mathematica Built-in

Important feature,  a lot is built-in

Don't need external toolboxes/packages for many things

Mathematica contains...

  full optimization support
  partial differential equation support
  data fitting
  statistics
  symbolic computation
  database connectivity
  report generation
  datafeeds

Mathematica 6

Released May 2007

Many many major improvements, including:

  Computation

  Visualization

  User Interface Construction

  Data Feeds
  
  Deployment

Instant Interactivity

A complete user interface in 10 seconds

Manipulate[ Plot[ Sin[x] + Sin[p x],{x,0,50π}],{p,0.9,1.1}]

Works for everything in Mathematica, not just graphics

Manipulate[ Series[Sin[x], {x,0,n}],{n,1,20,1}]

Manipulate[ ∫(1/(1-(x^n))),{n,1,20,1}]

What else is in Version 6?

In addition to the user interface enhancements 
very substantial updates/new functions etc... 
A few samplers

Visualization and Graphics

Visualization

Many new functions
Surface reconstruction and data plotting
Adaptivity
Opacity
Many new techniques (singularity testing, surface cutting)...  
      completely new styles of picture

Presentation Graphics

Editing of images
New options for laying out

Graph Visualization

graph plotting tools
graph editing tool

Specialized Plots

Many from packages
Date plotting

Mathematics and Algorithms

Optimization

non-linear constrained, 
integer mixed integer

Random Number Generation

New functions
New generators
Distributions, samples etc...
High quality and highly optimized

Symbolic Computation

Equational logic
New methods for DSolve and RSolve
Improved Integrate

Linear Algebra

New functions for matrix generation
Least Squares
KroneckerProduct
Vector functions
Hermitian and positive definite testing

Quadrature

New framework for NIntegrate
New tool for exploring NIntegrate solutions

Statistics and Data Analysis

New Distributions
Improved RNG
New Statistics Plots
Efficiency Improvements
Improved documentation

Special Functions

HankelH1 … KelvinKer … SphericalBesselJ  … ParabolicCylinderD …WhittakerM … SpheroidalS1 … ZernikeR
BesselJZero … AiryAiZero … ZetaZero
Bell numbers and polynomials
Ramanujan Tau function

Programming

Light-weight debugger
(Full Development Environment with Wolfram Workbench)

Option processing functions
Pattern constructs

Notebooks and User Interface

Interactive Elements

User Interface Controls

Documentation System

Notebook Environment

Data Processing and Feeds

Data Sources

Date and Time Formatting/Computation

Mathematica Deployment

Demonstrations Web Site

Mathematica Player

Visualization

More or less completely new...

Basic plot made many times,

Plot3D[Sin[x] Sin[y],{x,0,4π},{y,0,4π}]

now can spin zoom etc...

Adaptivity

Plots are much smoother,  more points where the function 
changes

Can see the computational grid

Mathematica visual grid different from computational grid

Iterator Limits

One iterator can depend on another

Plot3D[Sin[x y],{x,0,π},{y,-(Sqrt[x]),(Sqrt[x])}]

Contour Plotting

Adaptivity and other improvements

ContourPlot[Sin[x] Sin[y],{x,0,4π},{y,0,4π}]

Contour Labelling

All contours have a label tooltip

Add a permanent label with the ContourLabels option

Contours on Surface

Easy to add contours to the surface with MeshFunctions option

Plot3D[Sin[x] Sin[y],{x,0,4π},{y,0,4π},
	MeshFunctions->{#3&},
	ColorFunction->"Rainbow"]

Many other features for the MeshFunctions option

Plot3D[Sin[x] Sin[y],{x,0,4π},{y,0,4π},
	MeshFunctions->{#3&},
	MeshShading-> {Automatic,None}]

Isocontour Plotting

Adaptivity and other improvements

ContourPlot3D[(x^3)+(y^2)-(z^2),
	{x,-2,2},{y,-2,2},{z,-2,2}]

More embellishments,  eg add a Thickness ContourStyle

Singularity Handling

Handling of functions that are discontinous
      completely unique to Mathematica

Plot[Floor[x ],{x,0,20}]

More Elaborate

Plot[Sin[Floor[x]],{x,0,20},ExclusionsStyle->Directive[{Dashing[{.0025,.01}],Red}]]

Same for 3D

Same for 3D plotting

Plot3D[Floor[x y ],{x,-2,2},{y,-2,2}]

More Examples

Plot3D[Boole[(x^2)+(y^2) Boole[y>0]<1],
		{x,-2,2},{y,-2,2},Exclusions->{}]

Plot3D[Abs[x*y]*Boole[x^2+y^2≤2^2],{x,-5,5},{y,-5,5}]

Branch Cuts

Plot3D[Im[ArcSin[(x+I y)^3]],{x,-2,2},{y,-2,2},
Mesh->None, ExclusionsStyle->{None, Red}]

Specified Exclusions

Plot3D[1/(y^2-x^3+3 x-3),{x,-3,3},{y,-3,3},
Mesh->None,MaxRecursion->3,Exclusions->y^2-x^3+3 x-3==0]

Region Cutting

cutting parts of the surface

Plot3D[Sin[x+(y^2)],{x,-2,2},{y,-2,2}]

With cut

Plot3D[Sin[x+(y^2)],{x,-2,2},{y,-2,2},
RegionFunction->(1<((#1)^2)+ ((#2)^2)<5&)]

Also

ParametricPlot3D[
{(9+3 Cos[v]) Cos[u],(9+3 Cos[v]) Sin[u],3 Sin[v]},
	{u,0,2 π},{v,0,2 π},
	RegionFunction->(#4<#5&)]

Data Plotting

Function plotting ⟹ data plotting

Start with random data {...{x,y,z},...}

data =RandomReal[{-3,3},{200,2}];

data3D=Apply[{#1,#2,Exp[-#1^2- #2^2]}&,data,{1}];

ListPlot3D plots the surface

ListPlot3D[data3D]

See the data points

Same for other plotting functions

Surface Reconstruction

A data version of ParametricPlot3D

Basic torus function and some data

Torus[a_,b_,c_][{u1_,v1_}]:=
With[{u=u1  2π,v=v1 2π},{(a+b Cos[v]) Cos[u],(a+b Cos[v]) Sin[u],c Sin[v]}]

data3D=Map[Torus[9,3,3],RandomReal[{0,1},{2000,2}]];

Here are the points

Graphics3D[Map[Point,data3D],Axes->True]

This reconstructs the surface over the points

ListSurfacePlot3D[data3D]

Presentation Graphics

Make pictures images etc... in Mathematica for publication etc...

Visible Appearance

Many tweaks, changes in automatic styles

Interactive Editing Features

Good for fixing up pictures
Adding labels arrows etc...
Making completely new diagrams

Graphical Layout

New graphics options etc...

Graph Drawing Tools

many functions for computing with graphs
but also for drawing and working

Drawing

Data for history of Operating Systems

<<GraphUtilities`;

g={"5th Edition"->"6th Edition","5th Edition"->"PWB 1.0","6th Edition"->"1 BSD","6th Edition"->"Interdata","6th Edition"->"LSX","6th Edition"->"Mini Unix","6th Edition"->"Wollongong","PWB 1.0"->"PWB 1.2","PWB 1.0"->"USG 1.0","1 BSD"->"2 BSD","Interdata"->"PWB 2.0","Interdata"->"Unix/TS 3.0","Interdata"->"7th Edition","PWB 1.2"->"PWB 2.0","USG 1.0"->"USG 2.0","USG 1.0"->"CB Unix 1","7th Edition"->"2 BSD","7th Edition"->"32V","7th Edition"->"Xenix","7th Edition"->"Ultrix-11","7th Edition"->"UniPlus+","7th Edition"->"V7M","PWB 2.0"->"Unix/TS 3.0","USG 2.0"->"USG 3.0","CB Unix 1"->"CB Unix 2","32V"->"3 BSD","Unix/TS 1.0"->"Unix/TS 3.0","USG 3.0"->"Unix/TS 3.0","CB Unix 2"->"CB Unix 3","3 BSD"->"4 BSD","V7M"->"Ultrix-11","Unix/TS 3.0"->"TS 4.0","CB Unix 3"->"Unix/TS++","CB Unix 3"->"PDP-11 Sys V","4 BSD"->"4.1 BSD","Unix/TS++"->"TS 4.0","4.1 BSD"->"8th Edition","4.1 BSD"->"4.2 BSD","4.1 BSD"->"2.8 BSD","2 BSD"->"2.8 BSD","TS 4.0"->"System V.0","4.2 BSD"->"4.3 BSD","4.2 BSD"->"Ultrix-32","2.8 BSD"->"2.9 BSD","2.8 BSD"->"Ultrix-11","System V.0"->"System V.2","8th Edition"->"9th Edition","System V.2"->"System V.3"};

GraphPlot[g,Method->LayeredDigraphDrawing,VertexLabeling->True,
"VertexTextStyle"->{10}]

Graph Editing

General technique, based on interior point

GraphEdit[g]

Mathematica Itself

Now step back from new features 
   and look more at core Mathematica



Programming and Computation



(try to make this seem interesting...)

Mathematica Programming

Nice expressive literate programming style


Can write large efficient programs


Good for small scale programming
    low overhead
    suitable for non-programmer programmers

Good for large scale programming
   many tools etc...   
   full IDE with Wolfram Workbench

Computation: Basic Building Tools

Can divide between 

    basic building blocks,

and 

   functions that build on the basic blocks


Start with basic areas...

Arithmetic

Traditional machine arithmetic...  

but also:

  Large numbers,  high precision numbers,  tracking precision

  Extended precision computation is more reliable

  Slower than machine precision,  but suprisingly fast

  Very well supported across Mathematica functions

  Automatically flows from machine precision

Fast

Mathematica 6 is the fastest software for computing digits of Pi

N[Pi,2000000];//Timing

Can you Count?

({{Number, Expression}, {Four, ((((((⋯((((Sqrt[(Sqrt[⋯(Sqrt[4])])])))^2)⋯))^2)))^2)}, {Five, 5 ×(((1 + exp(-100) - 1)/(1 + exp(-100) - 1)))}, {Six, ((log( exp(6000)))/1000)}})

N[Nest[(((#)^2))&, Nest[((Sqrt[#]))&, 4,54],54],16]

N[5 (((1 + Exp[-100] - 1)/(1 + Exp[-100] - 1))),16]

N[((Log[Exp[6000]])/1000),16]

Hard for traditional arithmetic...

({{Number, Expression, Traditional Value}, {Four, ((((((⋯((((Sqrt[(Sqrt[⋯(Sqrt[4])])])))^2)⋯))^2)))^2), 1.00000000000000}, {Five, 5 ×(((1 + exp(-100) - 1)/(1 + exp(-100) - 1))), NaN}, {Six, ((log( exp(6000)))/1000), Inf}})

Linear Algebra

Basic area,  build other parts of the system

Full-support for sparse matrices
 
Wide range of matrix functionality
 
Many linear solve methods (dense and sparse,  direct and iterative)
    
advances in Version 6:  
  Kronecker products,  least-squares solving, 
  matrix extraction, named matrices,
  matrix functions

Non-traditional Areas

Many non-traditional areas:

	symbolic linear algebra
  	high-precision linear algebra

can have speed implications...

mat=RandomInteger[{0,1},{15,15}];
Eigensystem[mat];//Timing

mat=RandomReal[{0,1},{15,15}];
Eigensystem[mat];//Timing

Speed

Comparison of Mathematica and a common numerical matrix system
    (purely machine numerical matrices)

Dense Matrices

Sparse Matrices

Data Processing

Key part of technical computing -- working with data
eg changing so you can work with it...

Mathematica good at working with numerical data

and just the same at working with data that is not just numbers...

great system for experimenting

Flexible Expression Format

Mathematica can hold and work with everything immediately,  
	numbers,  formulae,  equations, data, graphics

A bit like XML trees

Does not need traditional structs, records etc...   

for example

data={{"Saturday", 10},{"Sunday", 20},{"Monday",6}}

TreeForm[data]

Pattern Rewrite

Mathematica pattern language concise and simple to use

Example

Generate a bunch of points and plot them

data=Table[{x,Sin[x]},{x,0,6Pi,0.02}];
ListPlot[data]

Now, embed them in 3D and plot them out

data /.{x_,y_}->{x,y,Sin[x y]};
ListPointPlot3D[%]

Formatted I/O

Mathematica an extensive coverage of formatted data.

Table and Spreadsheet Formats

General Data Formats

Geospatial Data Formats

Chemical Data Formats

Medical Data Formats

Matrix Formats

Database Formats

Raster Graphic Formats

Vector Graphic Formats

Geometric Modeling Formats

Discrete Graph Formats

Audio Formats

Multimedia Formats

Document Formats

Compressed Archive and System Utility Formats

Application Native Formats

Operating System Specific Formats

Data Computation

Many functions for data analysis, statistics...

Sorting

Very easy with
	flexible expression format
	combined with easy access to functions
	
data of dates and values...

data=
{{{1990,1,2},2434.1},{{1990,1,3},2463.7},{{1990,1,4},2451.6},{{1990,1,5},2444.5},{{1990,1,8},2431.3},{{1990,1,9},2436.3},{{1990,1,10},2412.6},{{1990,1,11},2417.9},{{1990,1,12},2380.1},{{1990,1,15},2366.2}};

Sort according to the value

Sort[ data, #1[[2]]<#2[[2]] &]

Binning

BinCounts[{1,3,2,1,4,5,6,2},{0,10,1}]

ListPlot[BinCounts[RandomInteger[BinomialDistribution[50,0.3],10^5],{0,50,1}]/10^4, Filling->Axis]

Clustering

data={{-1.1,2.6},{3.9,-0.8},{4.2,-3.7},{3.3,3.5},{3.9,5.2},{4.1,-4.8},{3.8,3.7},{5.6,0.1},{3.1,-5.2},{-0.9,2.3},{2.9,4.1},{-2.3,3.9},{-2.5,3.},{2.6,-5.5},{5.2,1.9},{-0.7,1.3},{0.9,2.8},{-1.5,3.3},{3.8,1.2},{2.6,-5.1},{-0.8,3.2},{4.7,0.7},{3.,3.},{3.9,3.6},{4.5,1.4},{4.2,1.3},{-1.1,2.6},{4.8,2.4},{3.3,-3.5},{3.2,-4.6},{3.3,-4.9},{3.,3.5},{0.7,2.1},{3.2,-4.3},{-2.,0.5},{-1.2,2.},{-1.6,1.8},{-3.5,3.7},{4.8,0.2},{3.3,2.4},{-0.1,2.1},{-1.3,2.5},{4.4,3.9},{3.5,0.2},{0.1,2.9},{-1.,1.6},{-1.4,4.5},{3.2,2.5},{-1.6,2.4},{2.6,-5.1}};

FindClusters[data]

getLines[pts_]:=
Module[{center},
center=Mean[pts];
Map[Line[{center,#}]&,pts]
]

Graphics[ {Map[getLines,FindClusters[data,2]]}]

Data Feeds

Major new feature of Mathematica 6

More later

Data Visualizing

Obviously many tools for visualizing data...

Random Number Generation

Mathematica 6 major overhaul of critical area

useful for statistics and sampling techniques

Speed

Mathematica is now very fast...

RandomReal[{0,1},10000000];//Timing

RandomReal[NormalDistribution[0,1],1000000];//Timing

Generators

Built-in generators

also extensible framework for adding generators...

Distributions

Built-in distributions...

also extensible framework for adding distributions...

Computation: Higher-Level Functions

Higher-level functions supported by basic building blocks.

Symbolic Techniques

Many symbolic functions

Numerical functions also use symbolic techniques,  
  for input processing
  problem analysis
  choosing methods
  switching methods

Automation

Mathematica has many opportunities for automation

Often based on symbolic techniques

Extended Precision

Numerical functions support extended precision computation,

  can get more accurate results
  an alternative route for computation
    good for benchmarking/reference

Ease of Use

promoted by

  careful design
  ability to works naturally with formulas and equations
  ability to work with functions

Extensive Documentation

Many levels of documentation and examples

NDSolve

Significant Differential Equation functionality

Critical for dynamical modelling/simulation

One of the most heavily-used functions in Mathematica

Support

Built-in support for 
	Initial Value ODEs
	Boundary Value Problems
	Differential Algebraic Equations
	Partial Differential Equations
	
Many methods for all of these...

Factory Super Function

Many systems provide different functions for each algorithm

Mathematica provides one function  (controlled by options)

({{"Mathematica", "Other Systems"}, {"", "ode45"}, {"", "ode23"}, {"", "ode113"}, {"NDSolve", "ode15s"}, {"", "ode23t"}, {"", "ode23tb"}, {"", "ode15i"}, {"", "dde23"}, {"", "ddesd"}, {"", "bvp4c"}, {"", "pdepe"}})

Mathematica is better because

  ●  it can auto select methods based on input
  ●  guarantees all methods have same input 
  ●  cleaner to extend
  ●  can change default 

(modern software design calls this a factory method)

NDSolve Methods

Note,  more useful naming conventions (also feature of modern software):

({{"ExplicitRungeKutta", "ImplicitRungeKutta", "SymplecticPartitionedRungeKutta"}, {"Composition", "Splitting", "DoubleStep"}, {"EventLocation", "Extrapolation", "FixedStep"}, {"OrthogonalProjection", "Projection", "StiffnessSwitching"}, {"ExplicitEuler", "ExplicitMidpoint", "ExplicitModifiedMidpoint"}, {"LinearlyImplicitEuler", "LinearImplicitMidpoint", "LocallyExact"}, {"Shooting", "Chasing", "IDA"}, {"MethodOfLines", "", ""}})

Mathematica has ODE, Boundary Value, DAE and PDE support.

Input Processing

It is very useful to be able to work with a formula

Solve the equation...

y''(t) -(1-((y(t))^2))y'(t) + y(t)==0 
for y(0)==0, y'(0)==2
from 0 to 20

Mathematica

Just type it in...

sol=NDSolve[{y''[t]-(1-((y[t])^2))y'[t]+y[t]==0,y[0]==0,y'[0]==2},y,{t,0,20}]

Easy to plot solution...

Plot[y[t]/.sol,{t,0,20}]

Traditional System

1) Rewrite the equation as a system of first-order ODEs

y'' - (1 -(y^2)) (y^(/))+y = 0 

becomes

(Subscript[y, 1]^(')) = (Subscript[y, 2])

(Subscript[y, 2]^(')) = (1-(Subscript[y, 1]^2))(Subscript[y, 2])-(Subscript[y, 1])

2) Code the system of first-order ODEs

function dydt = vdp1(t,y)
dydt = [y(2); (1-y(1)^2)*y(2)-y(1)];

3) Apply a solver to the problem

[t,y] = ode45(@vdp1,[0 20],[2; 0]);

4) Plotting etc... is also hard...

PDE Example

sol=NDSolve[{(∂_t)u[t,x]==0.5 (∂_(x,x))u[t,x]+(∂_x)u[t,x] u[t,x],u[t,-π]==u[t,π]==0,u[0,x]==Sin[x]},u,{t,0,2},{x,-π,π}]

Plot3D[Evaluate[u[t,x]/.First[sol]],{t,0,2},{x,-Pi,Pi},PlotRange->All]

Ease of Use

Mathematica is easier to integrate with other functions, eg plotting etc...

Customizable

Extensible framework for differential equations methods

NDSolve Mathematica 6

Many infra-structure changes...

Dense Interpolation Output:

Timing[a=NDSolve[{x'[t]==y[t],y'[t]==-x[t],x[0]==1,y[0]==0},{x,y},{t,0,1000},InterpolationOrder->All]]

Timing[d=NDSolve[{x'[t]==y[t],y'[t]==-x[t],x[0]==1,y[0]==0},{x,y},{t,0,1000}]]

Slower but more accurate

Plot[Evaluate[{First[x[t]/.a],First[x[t]/.d]}-Cos[t]],{t,0,10},PlotRange->All,PlotStyle->{Directive[Thick,Blue],Red}]

NIntegrate

New framework,  (equivalent to NDSolve, FindMinimum etc...)

many new methods and techniques


({{"GlobalAdaptive", "LocalAdaptive", "DoubleExponential"}, {"Trapezoidal", "DuffyCoordinates", "Oscillatory"}, {"PrincipalValue", "AdpativeMonteCarlo", "AdpativeQuasiMonteCarlo"}, {"MonteCarlo", "Boole", "ClenshawCurtis"}, {"GaussBerntsenEspelid", "GaussKonrod", "LobattoKonrod"}, {"LobattoPeano", "NewtonCotes", "SimpsonThreeEights"}, {"Trapezoidal", "Cartesian", "MultiDimensional"}})


  suitable for very high-dimension
  global adaptive

Explorer Tool

Needs["GUIKit`"];

GUIRun["Wolfram/NIntegrateExplorer/ExplorerGUI"]

Optimization

Steadily increasing in functionality

Before Version 6 Support

Before Version 6 support for 
	local and global techniques 
	linear and non-linear
	optimized for large problems
	linear/non-linear fitting
	multi-dimensional
	exact symbolic techniques
	interior point linear programming
	many options for tuning/refining

New in Version 6

Adds 
	non-linear constrained (interior point)
	non-linear and linear fitting
	quadratic programming
	integer and mixed integer programming

Quadratic Programming

Another special case of convex optimization

FindMinimum[{((x[1])^2)/100+((x[2])^2)-100,{10*x[1]-x[2]≥10,2≤x[1]≤50,-50≤x[2]≤50}},{x[1],x[2]},Method->"QuadraticProgramming"]

Certain problems fit well with quadratic programming

Portfolio Optimization

Find optimal asset allocation to minimize the risk, and achieve return

random example

{n,nyear}={100,50};
SeedRandom[1];
R=RandomReal[{0.7,1.4},{n,nyear}];
ER = Map[Total,R]/nyear;
Covariants=(R-ER).Transpose[R-ER];
vars = Array[x,n];
FindMinimum[{
vars.Covariants.vars,
Total[vars]==1&&
vars.ER≥1.08&&
Apply[And,Thread[Greater[vars,0]]]
},vars]//First//Timing

{n,nyear}={100,50};
SeedRandom[1];
R=RandomReal[{0.7,1.4},{n,nyear}];
ER = Map[Total,R]/nyear;
Covariants=(R-ER).Transpose[R-ER];
vars = Array[x,n];
FindMinimum[{
vars.Covariants.vars,
Total[vars]==1&&
vars.ER≥1.08&&
Apply[And,Thread[Greater[vars,0]]]
},vars,Method->"QuadraticProgramming"]//First//Timing

Non-linear Constrained

General technique, based on interior point

FindMinimum[(((1-x))^2)+100 (((-(x^2)+y))^2),{x,-1.2},{y,1}]

ContourPlot[(((1-x))^2)+100 (((-(x^2)+y))^2),{x,-1,1},{y,-1,1}]

Now add constraints

FindMinimum[{(((1-x))^2)+100 (((-(x^2)+y))^2) ,x+y<0.5},{x,-1.2},{y,1}]

Visual represention of solution

ContourPlot[(((1-x))^2)+100 (((-x^2+y))^2)==0.4,{x,-1,1},{y,-1,1}]

Some idea of the problem

Needs["Optimization`UnconstrainedProblems`"]

p = GetFindMinimumProblem[Rosenbrock]

FindMinimumPlot[p, Method->{"Newton", "StepControl"->"TrustRegion"}]

Constrained Fitting

General technique, based on interior point

data = Table[ {i,-Cos[i]+RandomReal[{-1,1}]},{i,-π,π,0.1}];
ListPlot[data]

FindFit[data,a+b x+c (x^2), {a,b,c},x]

Suppose want positive coefficients...  add constraints

FindFit[data,{a+b x+c (x^2), a>0&&b>0&&c>0}, {a,b,c},x]

Integer Programming

Put integer constraints

FindMinimum[{x+y,x>0&&y>0&&x+2y>3&&{x,y}∈Integers},{x,y}]

Can visualize with RegionPlot, also compare with unconstrained.

Larger Problem

Works for mixed problems and larger problems

file=ToFileName[NotebookDirectory[],"misc06.mps"];

The constraint matrix

Import[file,{"MPS","ConstraintMatrix"}]

MatrixPlot[%]

FindMinimum@@Import[file,"MPS"];

Can see a summary of the result.

Short[%,10]

FrontEnd Controls

Nicely integrated in the FrontEnd


Work very well with graphics


Simple to create

sliders, checkboxs, tabs, tooltips, popups, etc...

Manipulate

Parametrised User Interface

Very good for non-expert programmers

A complete user interface in 10 seconds

Manipulate Examples

Written by an enthusiastic user

Conic sections

Manipulate[ParametricPlot[(1/(1+e Cos[θ])){Cos[θ],Sin[θ]},{θ,0,2π},PlotRange->5,Epilog->{AbsolutePointSize[10],Point[{{0,0},{((-2e)/(1-(e^2))),0}}]}],{e,0,2}]

Foundations of calculus

Manipulate[Plot[{(x^2),(((x2^2)-(x1^2))/(x2-x1))(x-x1)+(x1^2),2x1 (x-x1)+(x1^2)},{x,-3,3},PlotRange->{-1,10},Epilog->{AbsolutePointSize[5],Point[{{x1,(x1^2)},{x2,(x2^2)}}]},PlotLabel->Row[{"gradient of secant = ",(((x2^2)-(x1^2))/(x2-x1))}]],{{x1,1},-3,3},{{x2,2},-3,3}]

Manipulate Summary

All examples could be written in C++/.NET/Java

But would require professional programmers and a lot of effort

FrontEnd Dynamic Mechanism

Unique wiring up mechanism

Dynamic Demo

Basic concept Dynamic

Dynamic[x]

Slider[Dynamic[x]]

Dynamic and Graphics

Basic concept...  the Locator,  click the locator and drag it around

pt={1,1};
Graphics[{Locator[Dynamic[pt]],Line[{{0,0},Dynamic[pt]}]},PlotRange->2]

Graphics that automatically update

Graphics[Line[{{0,0},
Dynamic[Refresh[RandomReal[{-2,2},2],
UpdateInterval->0.2]]}],PlotRange->2]

Parallelogram Example

pointClosest[p1_,p2_]:=
Module[{norm},
norm=p1/.{x_,y_}:>{y,-x};
p2-(p2-p1).norm/(norm.norm)  norm
]

parallelGram[pt1_,pt2_]:=Line[ {{0,0},pt1,pt1+pt2,pt2,{0,0}}]
pt1={1,0};
pt2={0.5,0.5};
pt3=pt1+pt2;
Graphics[{
Locator[Dynamic[pt1,(pt1={First[#],0}; pt3=pt1+pt2)&]],
Locator[Dynamic[pt2, (pt2=pointClosest[pt2,#]; pt3=pt1+pt2)&]],
Locator[Dynamic[pt3, 
(pt1={First[pt3-pt2],0};
pt2=pt2-(pt3-#);
pt3=#)&]],
Dynamic[parallelGram[pt1,pt2]]},
	PlotRange->4,
ImageSize->500]

Clock Example

makeHand[fl_, bl_, fw_, bw_] :=
Polygon[{{-bw, -bl},{bw, -bl},{fw,fl},{0, fl + 8 fw},{-fw,fl}}/9];

hourHand = makeHand[5, 5/3, .1, .3];
minuteHand = makeHand[7, 7/3, .1, .3];
secondHand = {Red,EdgeForm[Black],makeHand[7, 7/3, .1/2, .3/2]};

Graphics[{
{Thickness[.03],Circle[]},
{Thickness[.003],Table[Line[{.9{Cos[a],Sin[a]},.95{Cos[a],Sin[a]}}],{a, 0, 2π, 2 π/60}]},
{Thickness[.01],Table[Line[{.9{Cos[a],Sin[a]},.95{Cos[a],Sin[a]}}],{a, 0, 2π, 2 π/12}]},
Style[Table[Text[i,.77{Cos[-i π/6 + π/2],Sin[-i π/6+π/2]}],{i, 1, 12}], FontFamily->"Helvetica",FontSize->36],
Rotate[hourHand,Dynamic[Refresh[-6 Mod[AbsoluteTime[]/720,60]°,UpdateInterval->60]],{0,0}],
Rotate[minuteHand, Dynamic[Refresh[-6 Mod[AbsoluteTime[]/60,60]°,UpdateInterval->1]], {0,0}],
Rotate[secondHand, Dynamic[Refresh[-6 Round[Mod[AbsoluteTime[],60]]°,UpdateInterval->1]], {0,0}]
}]

Date Operations

new functions for working with dates

Date Formatting

New function: DateString

DateString[]

DateString[{"Year","+","Month","+","Day"}]

Date Cracking

Try to interpret date strings, useful for reading file logs etc...

Can use automatic detection...

DateList["2007+02+28"]

but might be ambiguous

DateList["20/02/28"]

but can give format

DateList[{"20/02/28",{"Year","/","Month","/","Day"}}]

Date Plotting

DateListPlot,  useful function for plotting dates

data=Table[Sin[i+RandomReal[]/4.],{i,0,1.5,0.01}];

Start dates from 2000, steps in 1 day

DateListPlot[data,{2000,1,1}]

Same as previously, but we reformat the text

DateListPlot[data,{2000,1,1},
	DateTicksFormat->{"Day","-","MonthName"}]

External Data

Data read from internet... web site of energy usage

data=Import["http://www.eia.doe.gov/pub/international/iealf/table12.xls",{"Data",1,248}];

Nice looking picture hard to make in 5.2

DateListPlot[Take[data,{4,-1}],{1980},Filling->Bottom,Joined->True]

Data Paclet Examples

Data paclets give many other examples

FinancialData["^DJI",{2000}]

Plot of Dow Jones, starting in 2000

DateListPlot[FinancialData["^DJI",{2000}]]

Plot of Microsoft and GE from 2000

DateListPlot[{FinancialData["MSFT",{2000}],
FinancialData["GE",{2000}]},Joined->True]

Data Feeds

major new functionality


data from many different areas


dynamically loading data (cache on your computer)


server at Wolfram Research 


extensible...

Geographical Data

Familar picture

CountryData["France","Shape"]

CountryData["Properties"]

Going Further

Mix with other types of plots...

GraphPlot[Flatten[Thread[#->CountryData[#,"BorderingCountries"]]&/@CountryData["SouthAmerica"]],VertexLabeling->True]

Data Computation

Combine with a data computation

Graphics[{Gray,CountryData[#,"SchematicPolygon"]&/@CountryData["Europe"],Thick,Red,Line[#[[Last[FindShortestTour[#]]]]&[Reverse[CountryData[#,"CenterCoordinates"]]&/@CountryData["Europe"]]]}]

Report Creation

Button["Country data notebook",CreateDocument[CellGroup[{TextCell[CountryData[#,"Name"],"Section"],ExpressionCell[GraphicsRow[{CountryData[#,"Shape"],Quiet[DateListPlot[CountryData[#,{{"Population"},{1970,2005}}]]]},Frame->All,ImageSize->450],"Output"]},Closed]&/@CountryData["Europe"],StyleDefinitions->"Creative/NaturalColor.nb"],Method->"Queued"]

Isotope Data

Atomic Isotopic Information

Take[IsotopeData[],20]

Example

Example: Data for decay of an U235

DaughterNuclides[s_List]:=DeleteCases[Union[Apply[Join,Map[IsotopeData[#,"DaughterNuclides"]&,DeleteCases[s,_Missing]]]],_Missing]
ReachableNuclides[s_List]:=FixedPoint[Union[Join[#,DaughterNuclides[#]]]&,s]
DecayNetwork[iso_List]:=
Apply[Join,Map[Thread[#->DaughterNuclides[{#}]]&,ReachableNuclides[iso]]]
decay = Map[IsotopeData[#,"Symbol"]&,DecayNetwork[{"Uranium235"}],{2}]

Draw the graph

LayeredGraphPlot[decay,VertexLabeling->True]

Element Data

Elements

ElementData[ ]

Demo

periods=Table[{z,ElementData[z,"Period"]},{z,108}];

periodList=Reap[Sow[#,#[[2]]]&/@periods][[2,All,All,1]];

ListLogPlot[Map[Tooltip[273+ElementData[#,"BoilingPoint"],ElementData[#,"Name"]]&,periodList,{2}],Joined->True,PlotMarkers->Automatic]

Chemical Data

Chemical Elements

ChemicalData["AcetylsalicylicAcid"]

ChemicalData["CyclosporinA", "MoleculePlot"]

Textual Data

The text of Darwin's "Origin of Species"

data=ExampleData[{"Text","OriginOfSpecies"}];
StringTake[data,1000]

Separate words used.

words=StringCases[data,w:LetterCharacter..:>ToLowerCase[w]];

Number of times each word is used.

Length[count=Reverse[Tally[words],2]]

Plot showing the number of appearances versus its frequency rating
for the 100 most frequently used words.

ListPlot[Apply[Tooltip,Take[Sort[count],-100], {1}],PlotRange->All]

Financial Data

Data of many stocks/indices

eg Dow Jones

FinancialData["^DJI",{2007}]

Make a date plot

Comparisons

DateListPlot[{ FinancialData["MSFT",{2000}],FinancialData["GE",{2000}]},Joined->True]

Comparisons -II

data1=FinancialData["^DJI",{1995}];
data2=FinancialData["^N225",{1995}];

DateListPlot[{data1, data2}]

let's normalize

norm1=Part[data1,Position[data1,{{2000,__},_},1,1][[1,1]],2];
norm2=Part[data2,Position[data2,{{2000,__},_},1,1][[1,1]],2];
dataNorm1=Map[#/{1,norm1}&,data1];
dataNorm2=Map[#/{1,norm2}&,data2];

DateListPlot[{dataNorm1, dataNorm2}]

Development Environment

Light-weight Debugger

Integrated into Mathematica FrontEnd

Workbench

Features

Full professional development environment

   full project support
   integrated debugger, profiler, unit tester
   code assist, syntax error/warnings, popups etc...
   working with other languages,  eg Java, C/C++
   integration with XML tools
   integration with ANT
   code management support,  CVS, SVN, etc...
   advanced code searching
   advanced code refactoring
   UI development
   web version
   grid version

Awards

The Workbench recently won a Dr Dobb's Producitivy Award

Deployment

in addition to traditional deployment 
	
	(well supported by Workbench)

Mathematica Player

free runtime for Mathematica user interfaces
   
   contains all functionality of Mathematica

Demonstrations Project

large collection of freely available interactive examples

(can run them with the player)

Example:   DayNight

Large collaborative effort...   encourage many people to contribute

Mathematica Player Details

notebooks must be signed
  (by the demonstrations site)

can't change and save the notebook
  (ie no authoring)

input only via user interface elements such as 
  sliders, check boxes
  (no general textual input)

But also...

Mathematica Player Pro

which is not free,  but much cheaper than Mathematica

fewer restrictions than Mathematica 
  ie notebooks do not need to be signed

details still being developed

Documentation System

Major overhaul of the system


New look and feel … more web like


Move away from the old Help Browser system


Integrated search system

Summary

● Major upgrade in Mathematica 

● Significant progress in many traditional areas computation, visualization

● Many specialized datafeeds hooked in

● User Interface Construction...  esp... for non-experts

● Mathematica Player...   free runtime for Mathematica

● Demonstrations site...  compliment for Player