====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gibson:teaching:spring-2016:math445:lab4 [2016/02/03 07:49] gibson |
gibson:teaching:spring-2016:math445:lab4 [2016/02/11 08:40] (current) gibson |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Math 445 lab 5: graphical data analysis ====== | + | ====== Math 445 lab 4: linear algebra and the truss ====== |
- | For this lab you will deduce the functional relationship between variables in data sets using graphical analysis. The data sets are given as // N x 2// matrices with //x// as the first column and //y// as the second. For each data set, you will find a function //y(x)// that fits the data, using the following steps: | + | **Problem 1:** Compute the following products in your head or with pencil and paper, and then check your answers with Matlab. Note: one of the problems is not well-posed and therefore does not have an answer. |
- | - Download or cut & paste the data set to a text file with an appropriate name, e.g. ''earthquakes.asc'' for problem 1. | + | **(a)** |
- | - Load the dataset to Matlab with ''load''. | + | <latex> |
- | - Extract the two columns of the loaded data into two appropriately named vectors, e.g. //R// and //N// for problem 1. For the remaining generic instructions I'll use the names ''x'' and ''y''. | + | x = |
- | - Experiment with ''plot'', ''semilogy'', ''semilogx'', and ''loglog'' to determine the functional relationship between ''y'' and ''x''. | + | \left[\begin{array}{ccc} |
- | - Estimate the constants in the log-linear relationship graphically to determine the specific functional relation between ''y'' and ''x''. | + | 4 & 3 & 8 |
- | - Plot the estimated function and the data together, and fine-tune your function by adjusting the constants until there is a good fit between the estimated function and the data. | + | \end{array} \right] |
+ | </latex> | ||
+ | and | ||
+ | <latex> | ||
+ | y = | ||
+ | \left[\begin{array}{c} | ||
+ | 2 \\ | ||
+ | 1 \\ | ||
+ | -4 | ||
+ | \end{array} \right] | ||
+ | </latex>. | ||
+ | What is $xy$? | ||
- | Once you have good fit between the data and the function, make a plot that shows | + | **(b)** |
+ | <latex> | ||
+ | x = | ||
+ | \left[\begin{array}{ccc} | ||
+ | 9 & 1 & 0 | ||
+ | \end{array} \right] | ||
+ | </latex> | ||
+ | and | ||
+ | <latex> | ||
+ | y = | ||
+ | \left[\begin{array}{ccc} | ||
+ | -5 & 6 & 2 | ||
+ | \end{array} \right] | ||
+ | </latex>. | ||
+ | What is $xy$? | ||
- | * the data set's //y// versus //x// as red circles | + | **%%(c)%%** |
- | * your function //y(x)// as a solid blue line | + | <latex> |
- | * a legend indicating the meaning of each plotting symbol | + | A = \left[ |
- | * appropriate labels for each axis and a title | + | \begin{array}{cc} |
+ | 3 & 1 \\ | ||
+ | 2 & -7 | ||
+ | \end{array} | ||
+ | \right] | ||
+ | </latex> | ||
+ | and | ||
+ | <latex> | ||
+ | x = \left[ | ||
+ | \begin{array}{cc} | ||
+ | 2 \\ | ||
+ | 1 | ||
+ | \end{array} | ||
+ | \right] | ||
+ | </latex>. | ||
+ | What is $Ax$? | ||
- | I recommend writing a separate script file to solve each problem, revising it as you | + | **(d)** |
- | go along to fix errors and tweak constants to make the curves match. Once you're happy | + | <latex> |
- | with your solutions to all four problems, copy all four scripts into one big script file | + | A = \left[ |
- | to use with Matlab's ''publish'' function. Make the published PDF beautiful and organized, | + | \begin{array}{cc} |
- | with "Problem X:" labels, graphs, equations, and your answers in text. | + | 3 & 1 \\ |
+ | 2 & -7 | ||
+ | \end{array} | ||
+ | \right] | ||
+ | </latex> | ||
+ | and | ||
+ | <latex> | ||
+ | B = \left[ | ||
+ | \begin{array}{cc} | ||
+ | 4 & -6 \\ | ||
+ | 0 & 2 | ||
+ | \end{array} | ||
+ | \right] | ||
+ | </latex>. | ||
+ | What is $AB$? | ||
- | **Problem 1: The distribution of earthquake magnitudes, by Moment Magnitude scale.** | + | **Problem 2:** Suggest a slight modification that turns the ill-posed problem from **1** into a well-posed problem, and then compute it by hand and with Matlab. |
- | Big earthquakes are rare, and little earthquakes are frequent. In fact, there is a | + | |
- | very clean empirical law that governs how many earthquakes of a given magnitude | + | |
- | typically occur world-wide in a given year. Your job is to deduce that law from | + | |
- | the following historical data. | + | |
- | <file - earthquake_magnitude.asc> | + | **Problem 3:** Given the 2 x 2 matrix |
- | % M N | + | <latex> |
- | 8 2 | + | A = \left[ |
- | 7 18 | + | \begin{array}{cc} |
- | 6 120 | + | 4 & 2 \\ |
- | 5 800 | + | -1 & 5 |
- | 4 6200 | + | \end{array} |
- | 3 49000 | + | \right] |
- | 2 365000 | + | </latex> |
- | 1 2920000 | + | and the 2-d vector |
- | </file> | + | <latex> |
+ | b = \left[ | ||
+ | \begin{array}{cc} | ||
+ | 3 \\ | ||
+ | 4 | ||
+ | \end{array} | ||
+ | \right] | ||
+ | </latex>, | ||
+ | what vector $x$ satisfies $Ax=b$? Solve with pencil and paper and with Matlab. | ||
- | The first column is the [[http://en.wikipedia.org/wiki/Moment_magnitude_scale | moment magnitude]] //M//, and the second column is the number of earthquakes //N// of that magnitude that occur, on average, in a year. The last two entries are estimates, since it's impossible to detect every small earthquake around the world. The data are obtained from [[http://www.earthquake.ethz.ch/education/NDK/NDK|Earthquake Statistics and Earthquake Prediction Research]] by Stefan Wiemer, Institute of Geophysics, Zurich. | ||
- | Using Matlab plotting commands, deduce the form of the functional relationship //N(M)//. Estimate the constants in the relationship by estimating the slope and the //y//-intercept, and then fine-tuning by matching the plot of your estimate against the plot of the data. | + | **Problem 4:** Solve the following systems of equations numerically with Matlab. |
- | **Problem 2: The distribution of earthquake magnitudes, by energy.** The moment magnitude scale is logarithmic, in that an earthquake of magnitude //M+1// releases about 32 times more energy than an earthquake of magnitude //M//. The following dataset gives the number //N// of earthquakes in a given | + | **(a)** |
- | year of energy //E// measured in Joules. | + | <latex> \quad |
- | <file - earthquake_energy.asc> | + | \begin{align*} |
- | % E N | + | 2x -y &= 8 \\ |
- | 6e16 2 | + | 6x-5y &= 32 \\ |
- | 2e15 18 | + | \end{align*} |
- | 6e13 120 | + | </latex> |
- | 2e12 800 | + | |
- | 6e10 6200 | + | |
- | 2e09 49000 | + | |
- | 6e07 365000 | + | |
- | <1e06 2920000 | + | |
- | </file> | + | |
- | Deduce the form of the functional relation //E(N)// using Matlab plotting, then estimate | ||
- | and fine-tune the constants in the relation, just as in problem 1. | ||
- | **Problem 3: World population.** The following data set provides the human population //P// of the earth at a given | + | **(b)** |
- | time //t//, measured in years A.D. | + | <latex> \quad |
+ | \begin{align*} | ||
+ | y + z &= 6 \\ | ||
+ | 3x-y+z &= -7 \\ | ||
+ | x+y-3z &= -13 | ||
+ | \end{align*} | ||
+ | </latex> | ||
- | <file - world_population.asc> | + | **%%(c)%%** |
- | % t P | + | <latex> \quad |
- | 1927 2e09 | + | \begin{align*} |
- | 1960 3e09 | + | 2x + y - 3z &= 0 \\ |
- | 1974 4e09 | + | 6x +3y -8z &= 0 \\ |
- | 1987 5e09 | + | 2x -y + 5z &= -4 |
- | 1999 6e09 | + | \end{align*} |
- | 2011 7e09 | + | </latex> |
- | </file> | + | |
- | + | ||
- | Deduce the form of the functional relation //P(t)// and determine the constants graphically. | + | |
- | Assume that the formula you derived for //P(t)// is valid indefinitely into the future and the past. What year will | + | **Problem 5:** Use Matlab to solve the problem. Nilanjana has 40 coins worth %%$%%6.40. They're all quarters and nickels. How many nickels and how many quarters does she have? Verify that your answer solves the problem. |
- | the population of the earth reach one trillion? What year were the first humans born? Do you believe these answers? | + | |
- | If not, why not? | + | |
+ | Hint: convert the story problem to an $Ax=b$ problem and then solve that with Matlab. | ||
+ | |||
+ | **Problem 6:** Use Matlab to solve the problem. Suhasini has 44 coins worth %%$%%7.50. They're all quarter, dimes, and nickels. She has twice as many dimes as nickels. How many of each type of coin does she have? Find the answer, and then verify that the solution satisfies the problem. | ||
+ | |||
+ | **Problem 7:** Use Matlab to solve the following problem (from //Numerical Computing with Matlab// by Clive Moler). | ||
+ | |||
+ | {{:gibson:teaching:fall-2012:math445:truss2.png?direct&600}} | ||
+ | |||
+ | {{:gibson:teaching:fall-2012:math445:truss3.png?direct&600}} | ||
+ | |||
+ | {{:gibson:teaching:fall-2012:math445:truss4.png?direct&600}} | ||
+ | |||
+ | One of the main challenges of this problem is figuring out how to enter the elements of the matrix quickly and reliably. For a small matrix, it's easy to type out the matrix explicitly like ''A = [ 1 9 7 ; 4 3 8 ; 6 2 0]'', but for a 13 x 13 matrix with 169 elements, that's tedious and error prone. | ||