Extreme Graphics with Extrema
also are special characters that you can use in indexing arrays. The
x[*] refers to all the values in the vector. If you want
the last element, you can use
x[#]. The second-to-last element can be
You likely have all of your data stored in files. The simplest file format is a comma-separated list of values. Extrema can read in these types of files and store the data directly into a set of variables. If you have a file with two columns of data, you can load them into two variables with the statement:
READ file1.dat x y
You also can read in all of the data and store it into a single matrix with:
READ\matrix file1.dat m nrows
In order to do this, you need to provide the number of rows that are being read in. You also can generate data to be used in your analysis. If you simply need a series of numbers, you can use:
x = [startval:stopval:stepsize]
This will give you an array of numbers starting at
startval, incrementing by
stepsize until you reach
stopval. You can use the
to do this as well. The GENERATE command also will generate an array of random
GENERATE\RANDOM x min max num_points
Extrema has all of the standard functions available, like the various types of trigonometric functions. The standard arithmetic operators are:
+ — addition
- — subtraction
* — multiplication
/ — division
^ — exponentiation
() — grouping of terms
There also are special operators for matrix and vector operations:
>< — outer product
<> — inner product
<- — matrix transpose
>- — matrix reflect
/| — vector union
/& — vector intersection
There also is a full complement of logical Boolean operators that give true (1) or false (0) results.
Now that you have your data and have seen some of the basic functions and operators available, let's take a look at graphing this data and doing some analysis on it. The most basic type of graph is plotting a one-dimensional array. When you do this, Extrema treats the data as the y value and the array index as the x value. To see this in action, you can use:
x = [1:10:1] GRAPH x
This plots a fairly uninteresting straight line (Figure 3).
Figure 3. Plotting a Vector of Values
Joey Bernard has a background in both physics and computer science. This serves him well in his day job as a computational research consultant at the University of New Brunswick. He also teaches computational physics and parallel programming.
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal
- Users, Permissions and Multitenant Sites
- Flexible Access Control with Squid Proxy
- High-Availability Storage with HA-LVM
- Tighten Up SSH
- Best. Cake. Ever.
- Security in Three Ds: Detect, Decide and Deny
- Nmap—Not Just for Evil!
- Building Tiny Linux Systems with BusyBox, Part 3
- Get Organized with Emacs Org-mode
- Bash Arrays