Assignment A1

All students are encouraged to try all exercises, but
During their respective lab session students solve the first three and attempt the fourth question.
3xx students should solve the first 6 exercises. If you hand in more than the required number your 6 best marks will be counted.
5/6xx students should solve 7 first exercises.
Exercises 8 is optional

1. Solve Heath Exc 1.4 (page 42). Show your calculations.

Consider the problem of evaluating the function sin(x), in particular, the propagated data error, i.e., the error in the function value due to a perturbation h in the argument x.

(a) Estimate the absolute error in evaluating sin(x).

(b) Estimate the relative error in evaluating sin(x).

(c) Estimate the condition number for this problem.

(d) For what values of the argument x is this problem highly sensitive?

2. Consider the recurrence relation Z_n = 1 - 2Z_(n-1).

(a) Explain what happens to the error when we start with an approximation for Z_1 and try to compute the values up to Z_n

(b) Rearrange the above to obtain a relation of Z_(n-1) in terms of Z_n. Then, explain what happens to the error when calculating Z_(n-k) given some starting approximation for Z_n. (c) Compare the importance of a good starting approximation in both of the above cases.

3. Consider a race car doing laps on some track. The car itself has many properties that affect its speed and therefore its lap time, but there are 3 key ones that can vary significantly throughout the race: its tire wear w (higher w = worse tires, less grip, car goes slower) the aerodynamics/drag factor d (more drag/air resistance, car goes slower) the weight of the fuel in the car f (more weight due to fuel, car goes slower)

Consider an ideal lap with brand new tires (0 tire wear), 0 extra drag, and 0 (weightless) fuel, which results in a an optimal lap time of 1:43.00 (1 minute 43 seconds exactly)

Increasing any of these factors will clearly increase the lap time. For simplicity, we will assume that the increases are directly proportional: The lap time is given by the baseline + a linear combination of the 3 variables. Extra note: the fuel load is indeed linear, but the drag and tire wear are actually much more complex factors in the physics that goes into them. However, for small changes, it may make sense to model these as linear.

As a race engineer, you have your driver run 3 laps with different setups. Your results are:
Trial A: tires at 0.35 wear, drag at 1.2, fuel load at 3
Trial B: tires at 0.2 wear, drag at 0.8, fuel load at 2
Trial C: tires at 0.1 wear, drag at 1.5, fuel load at 1

In your trials, you observe:
Trial A: 1:55.15
Trial B: 1:51:00
Trial C: 1:50.30
You observe that each of these times is (clearly) higher than optimal, and you would like to find the effect each of the 3 factors have on the extra lap time.

Clearly, the lap time is dominated by the baseline time of 1 minute and 43 seconds, which cannot be further reduced. We are only interested in the “extra” time given by a linear combination of the 3 variables. Therefore, we will subtract the ideal lap time from our results and model the system as a linear system of 3 equations in 3 unknowns.

Set up the linear system of equations. Present your results in equation and matrix form. Solve the system. x_exact: [3. 3. 2.5]'. This means for every “unit” change in tires or drag, 3 seconds are added to the lap time, whereas for fuel it is 2.5 seconds.

While in professional racing, your measurements for any given lap should be exact down to the millisecond, there can still be an inherent and significant delta in the lap time due to things like the weather or driver inconsistency. Consider the following two delta b vectors (in seconds):

db1 = [0.07715, 0.05136, 0.03756​]' db2 = [-0.05536, 0.08328 -0.00014​]'

Both represent a tiny variation in the recorded track time. Solving the system again, we get the following (I used this python script: https://drive.google.com/file/d/1XCzlWFhEMB4-b7_Nvx1ZbPHoGEXJ_ZNb/view?usp=sharing. it can be used to play with other error vectors):

Case 1: small-effect error vector
Delta b: [0.07715 0.05136 0.03756]
Q: What is the corresponding solution x? How different is it from the non perturbed x? Ie what is \Delta x
Q: How much is the relative error in x amplified compared to the relative error in b?
Why is this?: The difference is almost negligible, comparable to slightly more worn tires or slightly less fuel. This doesn’t seem so bad.

Case 2: large-effect error vector
Delta b: [-0.05536 0.08328 -0.00014]
Q: What is the corresponding solution x? How different is it from the non perturbed x? Ie what is \Delta x
Q: How much is the relative error in x amplified compared to the relative error in b? (This is a numerical sample of the condition number for solving an equation system)
Q: Now what do we see?: These results are devastating. While the drag factor did not change much, the fuel effect gained half a second (a significant change in racing, which people may or may not recognize depending on their knowledge), but the tire coefficient actually decreased so much it became negative which does not make any sense (generally, there is technically some cases where that can happen but that's not what we want to see when the lap time changes by a few hundredths of a second). This exemplifies the danger of an ill conditioned system.

Q: Suppose you want to test another setup with tire wear 0.25, drag 1, fuel load 2.5.
Given your coefficients, what lap time do you expect to see?
What would happen if you added this entry to the matrix?
If you were to actually go and test this setup as “trial D” and add the results (which will likely not exactly equal to those given by your linear system), would you still be able to solve the system?
(Bonus question for those who read ahead or have taken statistics courses). How would adding trial D, as well as E, F, G (...) help with the huge error deltas we saw earlier? Is there a geometric explanation?

4. While basking on Seba beach of Wabamun lake (west of Edmonton), in the distance I can just barely see the very top of the three power plant chimneys over at the eastern end of the lake. Determine the height of the chimney's with error margins. Assume the earth radius r=6366km, and make appropriate measurements with error margins in the map below. (You can assume the powerplant is in Kapasiwin).

Hint

5. Solve Heath Computer Problem 2.3 (page 100) , and answer the following two questions:
(a). For a 5% relative error in the load vector b, what is the error in the output? Do a condition number analysis. ( The condition number analysis described in textbook can be found here )
(b). If this is a bridge, why do we anticipate more uncertainty in the load vector b than the matrix A?

6. Farmer McDonald runs an organic and ecological operation on his rural Alberta property. Instead of burning non-renewable fossil fuels, he takes advantage of the heat emitted by the animals. Each cow emits 300 W, and each pig 250 W. He is contemplating building a new three room barn (in the third room is Hay, which emits no heat), and has enlisted the help of the numerical methods students to help with the calculation of the temperature he can expect in each room. The architect has provided the following drawing of the barn plus inhabitants:

Let the outside temperature T_0 be a balmy -20C. The heat conductance between the various rooms are as follows: k12 = k13 = k23 = 45 W/C, k10 = k20 = 25 W/C, k30 = 105 W/C. (The ones facing the outside k10, k20, k30 sum up the heat loss of the two or three outside walls. The large total area of the k30 wall is the reason for the high total heat loss)

From the laws of physics we know that energy is conserved. Hence for each room, the sum of the total heat energy emitted by the animals and the heat energy leaking through the walls is zero. The heat leakage through a wall depends on two things, the temperature difference across the wall and the heat conductivity of the wall and is given by P = k(To-Ti).

Using the above equation that for one k concerns one wall, write the heat balance equation for the whole room in the unknowns T1,T2,T3. For the three rooms we have three equations, which can be solved for the temperature in each room. Derive these three equations, formulate them in matrix - vector form and solve the equation system.

Note: My grandfather had a barn that was heated by cows and pis this way. Stayed 15-20C inside even when it was -5C outside
Note2: Some large energy efficient office buildings are heated by the humans inside. However, in many settings - typical western residences, malls, warehouses - the density of humans is too low compared to the insulation level to provide sufficient heating in the winter.
Note3: While furnace sizing for single family homes is quite primitive in North America, a heat calculation for commercial buildings beyond the furnace includes heat emitted by machines, computers, light etc.

7. Solve Heath Exc 2.17 (page 97) Note: Show your solution steps in obtaining the LU factorization. Ie you cannot just type it into matlab, but have to hand-calculate this small LU factorization... (But you may use matlab to check your result.)

Write out the LU factorization of the following matrix (show both the L and U matrices explicitly):

[ 1 -1 0]

[-1 2 -1]

[ 0 -1 1]

8(Optional). Open ended question: When was this satellite picture of campus taken? Try to find cues in the image, calculate date and time. Describe your assumptions, conclusions and error analysis.