Skip to content

bethel-physics/helloworld

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

helloworld

First lab activity

Contents

Basic MATLAB Syntax: data storage and processing time

Many problems in computational physics will eventually come down to the solution of sets of linear algebraic equations. The following exercise is intended to put the solution into perspective. Shown below is a table of operation counts and the memory requirements for a “direct solution method” using Gauss elimination. For an n-by-n matrix, the memory requirements and operation counts are summarized below:

Computing concept matrix size
Storage (words) n2 + n (matrix and right-hand-side)
Operations n3/3 + n2 (elimination and back substitution)

The size of a problem we want to solve may be restricted to limitations in memory (i.e., the memory available on a computer is insufficient to store all of the needed information) or by time (i.e., the time needed to perform all operation is excessive). Consider the solution of a linear system of equations on a smartphone with:

  • 2 Gbytes RAM (1 Gbyte = 10243 bytes of memory)
  • 64-bit “double precision” word size (1 byte = 8 bits)
  • reasonably well-written code that performs at 50 double-precision MFLOPS (1 MFLOP = 106 floating-point operations per second).

Problem 1:

What is the largest linear algebra problem (i.e., what is nmax) we could solve on your smartphone according to our memory limitations? Note: You can assume that we only need to fit the matrix and right-hand-side into memory (i.e., disregard the size of the rest of the program, the memory needs for the operating system, etc.).

Problem 2:

What is the largest problem you could solve on your smartphone at the last minute (i.e., in 60 sec) with its 50 MFLOPS processing speed?

Problem 3:

How long it would take to repeat the Gauss elimination calculation from Problem 2 if you were to repeat it on the ENIAC (330 single-precision flops)?

Tutorial 1 exercises:

  1. Defining vectors -- Use MATLAB to define the vectors shown in 2.2.2
  2. Defining matrices -- Use MATLAB to define the matrices shown in 2.2.4
  3. Matrix operations -- Perform the matrix operations shown in 2.2.6d
  4. Plotting -- Plot the vectors with various styles shown in 2.3.2
  5. User input -- Plot the function described after 2.4: Data Input
  6. Printing output -- Plot the function described after 2.4: Data Output

About

First lab activity (2/1/18)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages