cs 121 – quiz 3 questions 4 and 5. question 4 let’s generalize the problem:

6
CS 121 – Quiz 3 Questions 4 and 5

Upload: logan-gordon

Post on 13-Dec-2015

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: CS 121 – Quiz 3 Questions 4 and 5. Question 4 Let’s generalize the problem:

CS 121 – Quiz 3

Questions 4 and 5

Page 2: CS 121 – Quiz 3 Questions 4 and 5. Question 4 Let’s generalize the problem:

Question 4

Let’s generalize the problem:

Page 3: CS 121 – Quiz 3 Questions 4 and 5. Question 4 Let’s generalize the problem:

• Given a tower of height H, on a hill sloping at angle a, with guy wires tied down at a distance D on either side of the tower, how long are the guy wires L and R?

• L and R each form the side of a triangle of which the lengths other two sides are known, and the angle between them can be easily calculated. Let’s find the angles first.

• Angle a is one angle in a right triangle, so the unknown angle must be (90 – a), and therefore so is angle r, leaving angle l to be (180 – (90 – a)), or just (90 + a).

Page 4: CS 121 – Quiz 3 Questions 4 and 5. Question 4 Let’s generalize the problem:

• Now that we know two sides of each triangle and the angles between them, we can easily find the unknown sides using the Law of Cosines:

L^2 = H^2 + D^2 – 2*H*D*cos(l) R^2 = H^2 + D^2 – 2*H*D*cos(r)

• Remember that Maple expects the parameter given to cos() to be in radians, not degrees.

Page 5: CS 121 – Quiz 3 Questions 4 and 5. Question 4 Let’s generalize the problem:

Question 5

• Because there are 3 different versions of the same problem in this question, it makes sense to make a re-usable script. We can even re-use some of the script we wrote for Lab 3 Part 1.

• Let’s first identify the parameters:– T[i] – the body’s initial temperature– T[a] – the room’s temperature– T – the time taken to process the scene– B(t) – the body temperature after the scene has been

processed

Page 6: CS 121 – Quiz 3 Questions 4 and 5. Question 4 Let’s generalize the problem:

• Given those parameters, we can easily plug them into the given equation and solve for k.

• Now that we have k, we can find the time of death. We know the following:– k – we just calculated this– T[i] – living body temperature (98.6 degrees F)– T[a] – the room’s temperature– B(t) – the first measured body temperature

• Given this, we can easily plug them into the given equation and solve for t.