An intoduction to Mathematica

Jan M Baetens
KERMIT, Department of Mathematical Modelling, Statistics and Bioinformatics

Data structures and the functional programming paradigm

Lists at first glance

A={1,2}
B={{1,2},{0,10}}

(*MatrixFrom, Matrix functions, Partition*)

But functions at a closer inspection

TreeForm[A]

FullForm[A]

(*Part*)

Functional progamming = programming for the abstract

(*Agreement between mapping in mathematics and mapping in Mathematica*)

(*Map, Pure function, MapThread, Apply with Plus, MapIndexed ,NestList*)

Pattern matching

F={{a,1},{b,1},{a,2},{d,1},{b,3},{d,5}}

(*Select, Cases, _Integer, ReplaceAll, GatherBy, SortBy, Tally, Delayed replace*)

SortBy[Range[1,10],Sin[#]&]

Symbolic and numeric computation

(*N with arbitrary precision*)

Graphic primitives

(*Graphics, Graphics3D, Line, Circle, Circle, Disk,...*)

Defining functions and local variables

(*With and without Module, input restrictions*)

Mathematical operations

(*D, Integrate, Limit, Solve, RSolve, DSolve, NIntegrate, NDSolve, SIR-Model*)

NIntegrate[1,{x,y}∈Circle[]]

Regio=ImplicitRegion[(x^2)+(y^2)<=1,{x,y}];

RegionPlot[Regio]

NIntegrate[1,{x,y}∈ImplicitRegion[(x^2)+(y^2)<=1,{x,y}]]

NIntegrate[Boole[x^2+y^2<1],{x,-1,1},{y,-1,1}]

NIntegrate[1,{x,y}∈Disk[]]

NIntegrate[((x )^2)+(y^2)+(z^2) ,{x,y,z}∈Ellipsoid[{0,0,0},{1,2,3}]]

Visualisation and animation

(*ListPlot, Plot, Plot3D, Manipulate, ListAnimate, DateListPlot*)

ContourPlot[x y,{x,y}∈Disk[{0,0},1]]

Data Manipulation and Analysis

(*Import, Export, WeatherData, CityData*)

DateListPlot[WeatherData["Ghent", "MeanTemperature", {{2007, 1, 1}, {2007, 12, 31}, "Day"}], Joined->True]

Parallelization

(*ParallelTable, ParallelDo, ParallelEvaluate*)