Physics with Mathematica

Seventh Class

No class next week! Use the time to do some work on your homework problems

Today: Basic data analysis

Remove["Global`*"]

Think of data simply as lists of numbers you can analyze or otherwise operate on

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

Mean[data]

StandardDeviation[data]

Part[data,3;;6]

Length[data]

Sort[data]

Select[data,#>2&&#<7&]

Reading in data from files

Define a couple of lists to be used as matrices. Note, we will only be making use of square matrices.

SetDirectory[NotebookDirectory[]];

Import["Class07_Data.dat"]

With more than one value per line, the inner lists would have more than one value.

data=Flatten[%]

Making histograms

You can make the plots or retrieve the frequency values

Histogram[data]

Histogram[data,10]

Histogram[data,{5}]

BinCounts[data,{5}]