Lab Report

by My Name

Student ID #

BASIC Computer Programming

Teaching Assistant: TA Name

Chem 374-005

Group #6

10/17/96

Performed: 10/3/96

Lab Partner: Their Name

Abstract

This experiment was an exercise in programming in the BASIC language for scientific data analysis. The program read a data file of arbitrary length (up to 1000 data points), created a graph, then displayed and saved statistical results. The program was written in QuickBASIC version 4.5, which is a form of compiled BASIC (as opposed to interpreted BASIC).

Introduction & Theory

Computers allow flexible and automated analysis of data through the use of programs. These programs serve as instructions that tell the computer exactly what to do with input, how to do it, and what to output. In modern computer systems, programs are written (created) using other specialized programs, known as compilers or interpreters. These programming languages, as they're called, convert English statements into the ones and zeros that the computer understands. By entering sets of these specialized statements (called source code) into a compiler, a program is created.

Nearly all computer "bugs" are caused by programming errors. The programming languages are quite terse, and must follow a logical sequence. A misplace semicolon or forgotten command can cause the program to stray from the desired logical path. As an analogy, if you bake all the ingredients of a cake before mixing them together (instead of after), you'll get a jumbled mess as a result. Similarly, a programmer must pay strict attention to detail if the desired result is to be obtained.

Experimental

The program was designed in accordance with a handout, Basic Computer Programming, that was given out in lab. A single data file was read by the program, analyzed, graphed, and resulting statistical information was saved to disk.

Results

The following data points were used as input:
X Data 33.9 34.5 37.5 39.1 41.1 12.2 45
Y Data 1497 1495 1493 1494 1493 1490 1490


The slope and intercept of the best-fit line were found with the following formulas:

Other deviation analysis results were also calculated, as show below.

Using these formulas, the following results were obtained:

Best fit line

Slope= -0.5740777

Intercept= 1515.557

Statistical Data

N=7

Coefficient of determination= 0.8410077

Coefficient of correlation= 0.9170647

Standard estimate of error= 1.111574

A graph of the data points and the best fit line may be found in the attached appendix.

Discussion

The use of a QuickBASIC compiler allowed a program to be written that can analyze and plot up to 1000 data points nearly instantaneously. The limit of 1000 data points may be raised with minor adjustments to the source code. The limit was chosen because it is rare for more data to be analyzed at one time, and setting the limit too high may have prevented the program from running on some systems, as well as increasing the time it would take for the program to initialize. It is estimated (strictly from past experience) that this program should execute in 50k of memory or less.

References

Basic Computer Programming, a handout distributed during lab.

The internal help system of QuickBASIC was used to obtain details of command use.