Assignment A4

501 students do all exercises, 340 students do exercises 1, 2, 3, 4. Note: question 5 is a bonus question worth up to an additonal 5% of your assignment grade.

Exc 1: Solve Heath Computer problem 6.7 (a), (b) and (d) (p. 303). Part (c) is not graded. A suggested tool for 3D graphing is GeoGebra or Desmos. For part (d), implement your own minimization routine such as Newton's method, and plot at least 5 iterations as points on the 3D graph. Give an example of a starting point that avoids the saddle points, and one that take more iterations to get around the saddle points. Hint: For a 2x2 Hessian [a, b; c, d], the eigenvalues (lambda) are the solutions to the quadratic equation (a-lambda)*(d-lambda) - b*c = 0


Exc 2: Solve Heath Computer problem 6.15 (p. 305).


Exc 3: Solve Heath Computer problem 6.19 (p. 306)


Exc 4: Consider a planar 2-DOF robot arm with joint angle θ=[θ_1​,θ_2​]^T

Task 1: Point-to-point alignment. The robot must move its end effector tip to a single point target T1 = (x_star, y_star). Assume the target point is within the reach of the robot.

Task 2: Box-to-box alignment. The robot is holding a rigid rectangular box, and there is no additional DOF. The goal is to move the four corners of the box to four ordered target points T1, T2, T3, T4. The target can be closely but not perfectly aligned with the box due to a small rotation and size difference in the target.

Heath Chapter 5 and 6 is helpful to reference equations for this question.

For task 1,
  1. Write the vector-valued residual function r(θ) representing the error between the current tip position and the target. Write it with respect to θ using forward kinematics.
  2. In matrix-vector notation, write the update step equation for Newton’s method for root finding to solve for Δθ. What are the dimensions of the Jacobian for this system and what does each dimension correspond to? Do a dimensionality analysis showing the shape of each vector and matrix in this equation.
For task 2,
  1. There are 4 corners, each with a (x,y) constraint. Can you use Newton’s method for root finding to minimize this system? Why or why not? Explain if there exists a solution physically in terms of the robot and target, and also mathematically.
  2. Write the residual function in terms of the box corner positions and the target positions. Write the scalar-valued nonlinear least squares objective function φ(...) (what we are trying to minimize). Include the dimensions of the input and output.
  3. Explain in words why non-linear least squares is suitable for this problem, and why Gauss-Newton is an appropriate approximation to Newton’s method here. What is the specific effect of approximating the Hessian with J^T J? i.e., explain what information is lost when dropping the residual term. (Heath 6.6)
  4. In matrix-vector notation, write the Gauss-Newton update equation. What are the dimensions of the Jacobian? Do a dimensionality analysis showing the shape of each vector and matrix in this equation.
Bonus: Derive the equation for the Hessian for least squares (Heath 6.6). Hint: start with the objective function and take the derivative. Then use the product rule and differentiate it again. A resource: pdf.

Exc 5. (note: numerical integration will not be on your final) An automobile consumes far more fuel for the first few
kilometers (when cold started) than when it is properly warmed up. To measure the fuel consumption an in-line fuel flow rate sensor is used which measures the instantaneous fuel flow in liter (such a thing is already installed in modern cars with electronic fuel injection but manufacturers choose not to show the measurements to the consumer. However there are aftermarket devices that can read data from the car computer). Below is a table with distance x in km and instantaneous fuel consumption in liter/km.

a. cmput 340 : Integrate numerically using the midpoint, trapezoid and Simpsons rule using all the data points to arrive at an as good as possible estimate of the total amount of fuel consumed in the first 10km of driving. What is a reasonable estimate for the error in your midpoint and trapezoidal rule value respectively?
cmput 501 Perform the above but instead with Romberg integration. (Trapezoid rule and repeated Richardson extrapolation, Heath p.370.)

b. (all students) Suppose we wanted to know the amount fuel used to drive 8 km how might we go about finding this? What would the amount be?

Distance x km
0
1.25
2.5
3.75
5
6.25
7.5
8.75
10
Consumption f(x) l/km
0.26
0.208
0.172
0.145
0.126
0.113
0.104
0.097
0.092