Modeling/Solving/Plotting in Octave and R

There are many software packages for modeling physical systems, solving equations, analyzing statistics and plotting results. The focus of this document is to introduce several open-source packages that are widely used and, therefore, useful beyond one's undergraduate experience.

Octave

Octave is a GNU project for performing numerical computations. It is similar to MatLab (Commercial Package from MathWorks) and many scripts written for the one will work with the other. Octave is available for Linux, Windows, OS X and Android operating systems. Octave is an open-source language with matrix support and built-in mathematical and graphics operations. This is also true of MatLab.

To get started with Octave the following documents may prove useful:

Installing Octave is fairly easy. Go to the main web site at https://www.gnu.org/software/octave/ and click on Download. Select your operating system to download the correct binaries.

If you want to use Octave in Android, go to Google Play and search on Octave. You need to load GNURoot Octave. It will also ask you to install GNURoot Debian, which provides the Linux environment needed to run Octave. You also need to install Octave Main Package.

If you want to install additional packages, go to Octave-Forge and look at the list of packages at http://octave.sourceforge.net/packages.php. Once you know the package name you can perform the following command at the Octave command prompt.

Before using a function contained within a package the following command must be given. To remove access to the package's functions use the second command.

R

R is a software package used for statistical analysis and graphing. It is available for Linux, Windows and OS X. Unlike Octave, R is designed around the programming language LISP.

To get started with R the following documents may prove useful:

Installing R requires that you select a download site from the CRAN Mirrors. The list of sites is at https://cran.r-project.org/mirrors.html. Once at that site, select the binary distribution (Linux, OS X or Windows).

R has many packages that extend the functionality of the program. Access to these packages is through the link http://cran.case.edu/web/packages/available_packages_by_name.html. Packages can be install by two methods.

  1. Download the zip file directly from this web page. Start R and select the menu Packages. The last option is to install packages from zip files. A dialog box will open and locate the file you just downloaded.
  2. Without downloading the zip file, start R and select the menu Packages. Select Install Package(s). If you have not previously selected a CRAN mirror site, you will be provided a dialog box to do so. After that, you will get a dialog box with all of the packages available for download.

Once you have install a package, you need to load the package in order to use its functions. This is done with the command:

If you don't know which packages you have installed give the following command and all of your locally install packages will be listed.