Numerical Analysis

Introduction: Many, many problems in physics and engineering have no easy analytic solution, and others are down-right unsolveable by any analytic means. The way around these difficulties is to solve the problems numerically. Those who use a graphing calculator are already experienced in some of these methods. Numerical solutions have been around for years, but before the advent of fast, inexpensive PCs, solving by numbers was almost as tedious as the analytic solutions. In this lab you will solve some common but messy problems using the spreadsheet. Later on this semester you will solve a Fourier series numerically, so there's an introduction for that as well.

For all three tasks you will need this spreadsheet. Turn only this in after you have completed the assignment.

Integration: Click the tab for integration. Some integrals are easy to solve, others require various tricks and techniques. Some functions are so messy that numerical integration is infinitely preferable. Such a function is:

Function 1

This is the function with which you will work. Notice that we can only solve the definite integral with this numerical technique; we will calculate this integral from 1 to 5:

  1. Make a column of data from 1 to 5 in increments of 0.01 (x on your sheet).
  2. Make the next column the Function 1 values of the first column (f(x)).
  3. Plot it out so you can see what it looks like; use X-Y scatter but with smoothed lines, not markers, so you can get a clear view.
  4. The integral of a function is the area under its curve. We will approximate it by subdividing the total area into little rectangles:

Graph 1

    1. Note that this will over estimate the volume since each rectangle sits above the curve, and that this is not our f(x).
  1. The width of each rectangle is the increment from 1), and the height in the function value for that x.
  2. The solution should be obvious now: sum the rectangles over the domain from 1 to 5.
  3. Answer this question in a text box on the integration sheet: how could we make this approximation more accurate?

Root Search: Transcendental equation. No, this isn't solved by meditation. A transcendental equation has the variable stuck in inconvenient spots, such as:

Function 2

See how you can't isolate the X? This equation comes from Wien's displacement law in Physics 203 and can be solved numerically.

  1. Click the root search tab.
  2. Fill column A from 0 to 20.
  3. Make a column for the left side of the equation, and another column for the right side next to the first column. Alternately, you may make a single column if you set the equation equal to zero.
  4. Find where column B is approximately equal to column C (or the single column is close to zero). Note the lower and upper values (previous and subsequent rows) near this point in column A.
  5. Refill column A starting with the lower limit and choosing a step (increment) much smaller than the first, making sure that the upper limit is reached. This tedious task can be simplified by clever addressing!
  6. Repeat this procedure with progressively smaller increments reducing the range until your upper and lower limits bracket the solution. Use tiny increments to get the solution to 12 places.
    1. Making a graph of the difference between the left and right function is informative and can help you "zero" in.

Sinusoidal Noise: This was hinted at earlier this semester. Click open the sine noise sheet; there you will see two columns of numbers that plot like this:

Graph 2

There is obviously a sine wave there, but there is another signal that we don't want. This "noise" is another anomalous sine wave, and we'd like to get rid of it. If we knew its amplitude and frequency, we could just subtract it from the original function.

In real life there is rarely just one wave that interferes: a notable exception is the 60Hz AC wave that emanates from US electrical wiring. This "hum" leaks into unshielded audio and is very annoying! However, eliminating it is relatively easy and parallels this method.

Your noise wave here is only another sine wave, an integer multiple of the original's frequency at some amplitude. If you can find the amplitude and frequency, you can subtract its signal at each x to clean f(x) up.

  1. First, make a graph like Graph 2.
  2. Make another column for your sinusoidal noise function:
    1. Choose an amplitude for the sine and a multiplier for x (the harmonic number).
    2. These two numbers will require frequent adjustment, so burying them in the formula is not the most efficient use of your time. Again, creative addressing is the answer!
  3. Make a third column subtracting your sine function from f(x), and graph x and this difference.
  4. When you find (by trial and error) the correct amplitude and harmonic for your "anti-noise", your difference graph will look like this:

Graph 3

We will play again with wave addition later in the Fourier Analysis and Synthesis lab.

Question: Combining what you learned about motion in a vicous medium in class (Chapter 5) and what you learned in this lab, answer the following question: