# QUIZ Practice Programming Problems

Location: http://people.sc.fsu.edu/~jburkardt/m_src/quiz/quiz.html

QUIZ, MATLAB programs which suggest how to write MATLAB programs to solve some simple questions.

### Languages:

QUIZ is available in a MATLAB version.

### Related Data and Programs:

AREA_UNDER_CURVE, a MATLAB function which displays the area under a curve, that is, the points (x,y) between the X axis and the curve Y=F(X).

BISECTION_RC, a MATLAB library which seeks a solution to the equation F(X)=0 using bisection within a user-supplied change of sign interval [A,B]. The procedure is written using reverse communication.

MATLAB_RANDOM, MATLAB programs which illustrate the use of Matlab's random number generator (RNG) functions.

PUZZLES, MATLAB programs which were used to solve various puzzles.

SUDOKU, a MATLAB library which handles Sudoku puzzles;

TIMER, MATLAB programs which demonstrate how to compute CPU time or elapsed time.

### BACKGROUND:

During class, we will go over these problems one at a time. I will give some background to the problems, and make some suggestions to get you started, but then I hope we can work together on a common solution. And then I hope we can write a better program, and maybe an even better one.

During the exercises, I will introduce some MATLAB concepts that may be new or vague or confusing to you. I will supply a short reference sheet that I think will help you.

### AREA:

The integral of f(x) from x1 to x2 is the area between the x axis and the curve. Consider the function f(x) = 3/4*(1-x^2), over the interval -1.5 <= x <= 1.5. If we can't use calculus, what other methods can compute or estimate this area?

### CLOCK:

At 2:00, the minute hand (pointing at 12) is "behind" the hour hand (which points to 2). At 3:00, the minute hand has passed the hour hand. When did the two hands meet? How can we compute with hours, minutes and seconds without going crazy?

### CURVE:

I want to plot the function

y = cos ( 100 * x ) - 4 * erf ( 30 * x - 10 )?
from 0 to 1, evaluating at x = 0/5000, 1/5000, ..., 5000/5000. Does it make a difference whether I plot one point at a time, or all at once?

### HAIL:

Start with a number N. If it's even, divide it by 2. If it's odd, multiply by 3 and add 1. Repeat. Eventually, you reach a value of 1. Count how many steps it took. This is the hailstone number of N. Do we see a pattern if we compute and plot HAIL(N) for many values of N?

### HAND:

Estimate the area of my hand.

### POWERS:

Make a table of powers 2^n? How far can we go before we see the effects of computer arithmetic? What about a table of (2^n)-1?

### TANK:

A spherical water tank has radius R. If it is filled to a depth H, what is the volume V of water it contains? If we can weigh the tank and determine the volume V, then what is the height of the water in the tank?

You can go up one level to the MATLAB source codes.

Last revised on 01 October 2015.