Advanced data handling

Import

Syntax: Import[file, data type]

Import[] can import data from two types of files, TXT and BMP. If you don't specify "data type" Eudox will look at the extension of the file to know whether to load the file as a TXT or BMP.
When you load a TXT, you use a line break in the TXT file to tell Eudox that go to the next value in the data. You can also load pairs of values, for example an x and a y point by making a tab between the values.
Here is a file with values.

We place the file "prime.txt" in our Eudox directory. To load the file in to Eudox and store the values to the variable 'a' you do like this.

This shows the values in a plot.

Here is a file were we have entered pairs of values. The two values at each line are separated by a tab.

This loads the file prime2.txt in to Eudox and store it in 'a'.

This loads and displays a bmp.

Export

Syntax: Export[file, data]

This create a file named "test.txt" and save the values in 'a' in to it.

Fit

Syntax: Fit[data ,origin?]

Fit is a very useful function to analyse data. It tries to fit a line to some data points and return the best possible line to the data. This is very important and is often used to calculate a constant out of data observed in an experiment.
This loads some data and tries to fit a line to the data.

Fit assume that the first value in 'a' (2) has x-value 0, the second (3) 1 and so on. This loads almost the same values but now the x coordinate is specified.

Note that the result from Fit is a bit different. This is because now we specified that the first y value (2) should have the x value 1 instead of 0.

DataInfo

Syntax: DataInfo[data]

This gives some info about the data variable 'a'.

Random

Syntax: Random[type, start, stop]

This create a real random number between -3 and 5.7

"type" can be "Real" or "Integer". If you don't give any elements Random[] will random 0 or 1. This creates a table with random integers from 0 to 10.

Next: Special functions and variables

Table of contents