MIT
Cupcakes!

18.085 Fall 2010

Homework

  • Suggested problems on the final topics for the exam Monday December 6

    4.3: 15;
    4.4: 1, 2, 6, 8;
    4.5: 1, 2, 10, 11, 12

    We won't collect this homework since the exam is so close -- the FFT will not be on the exam, convolution and Fourier integrals will be included.

    Solutions

  • Homework 8 due WED November 24 (there is class that day, I will try to make the topic less crucial because of the Thanksgiving holiday)

    4.1: 1, 3, 5, 7, 13;
    4.2: 3;
    4.3: 2, 6, 10, 11;

    MATLAB:

    The homework is about the important "Gibbs phenomenon". Create a figure like Fig. 4.2 showing the partial sums of the Fourier series for the SQUARE WAVE in equation (8) of 4.1. It jumps from -1 to +1 at x = 0.

    Can you determine the amount of the overshoot at the jump?

    Find a relation between the WIDTH of the overshoot (the first lobe above +1) and the NUMBER of terms in the partial sum for the square wave.

    New question (to me): Beyond the overshoot in Fig. 4.2 it looks to me that there is a smaller UNDERSHOOT below +1. Is this true in your graph of partial sums? What depth of undershoot? Maybe you can blow up the figure near the jump.

    Solutions to #8 (Due to Areg Hayrapetian)

  • The Exam 2 average is 77. Solutions can be found here.

  • Homework 7 for WED November 10 will NOT be collected. It is to help prepare for the 2D finite element question on the exam.

    3.5: 1;
    3.6: 2, 3, 7, 8, 10, 11, 18 (none are big calculations)

    Normal help sessions: Friday Nov 5 and Monday Nov 8. More soon about the exam.

    Solutions to #7

  • Homework 6 due WED November 3

    3.3: 6, 8, 10, 16, 27;
    3.4: 2, 4, 5, 6, 17;
    and also: On page 269, complete the 4th degree solutions u and s in both x,y and r,theta coordinates.

    MATLAB: Laplace's equation by centered differences

    The problem is Laplace's eqn on the unit square with boundary conditions u = y on the side x = 1, u = x on the side y = 1, w:n = -y on the side x = 0, w:n = -x on the side y = 0.

    Replace the 2nd derivatives in Laplace's eqn by centered second differences. This gives the "5-point discrete Laplacian" on a square grid:
    [u(x+h,y) + u(x-h,y) + u(x,y+h) + u(x,y-h) - 4 u(x,y)] / h^2

    Set h = 1/11 giving 10 X 10 = 100 interior grid points with 100 unknowns u(x,y). The 100 grid points fall in a square array but you have to make them into a VECTOR with 100 components. I usually number them by rows, u1 = u(h,h) and u2 = u(h,2h) and next row u11 = u(2h,h) and last corner u100 = u(10h,10h).

    At two boundaries we know u. At the left boundary x=0 we know w.n and thus u' Replace by [u(h,y) - u(0,y)]/h =....
    This gives u(0,y) in terms of u(h,h); Substitute in the 5-point equation to eliminate u(0,y). Similarly, eliminate u(x,0) on the boundary y = 0 where du/dy is given.

    Set up the whole system as K u = f where K is 100 by 100. Is K symmetric?? Is K positive definite?? (Let MATLAB decide.) Print out diag(K). IT SHOULD NOT BE ALL 4's.

    K is banded around the main diagonal. What is the bandwidth so K(i,j) = 0 if abs (i-j) > w ? What are the largest and smallest eigenvalues of K ? Use the command eig(K).

    Print out v, the first column or row of K inverse. This gives the value of U(h,h) at the lower left corner from the right side f. What is the ratio of the first component v(1,1) to the last component v(10,10) ?

    EXTRA COMMENTS BY EARLIER TA
    We thought it could be useful for you to know how the matrix looks like for h= 1/4, therefore 9 grid points.

    | -2 1 0 1 0 0 0 0 0|
    | 1 -3 1 0 1 0 0 0 0|
    | 0 1 -3 0 0 1 0 0 0|
    | 1 0 0 -3 1 0 1 0 0|
    | 0 1 0 1 -4 1 0 1 0| times (1/h^2)
    | 0 0 1 0 1 -4 0 0 1|
    | 0 0 0 1 0 0 -3 1 0|
    | 0 0 0 0 1 0 1 -4 1|
    | 0 0 0 0 0 1 0 1 -4|
    On the RHS you should have:
    |-2|     | 0|
    |-2|     | 0|
    |-3|     |-1|
    |-2|     | 0|
    | 0|   + (1/h) | 0|
    | 0|     |-2|
    |-3|     |-1|
    | 0|     |-2|
    | 0|     |-6|

    Solutions to #6 (Due to Areg Hayrapetian)

  • Homework 5 due WED October 27

    3.1 1, 3, 5, 9, 10, 12, 14, 18
    3.2 1, 3, 5, 6

    MATLAB Choose problem A: section 2.6 pbm 7 (turn in color picture) OR problem B as follows

    B. This Newton's method problem is to solve 3 equations (reducible to 2) for the unknown [latitude phi ] [longitude lambda ] [height h ] We are given X, Y, Z:

    X = (N + h) cos phi cos lambda   or     f1 = (N + h) cos phi cos lambda - X = 0
    Y = (N + h) cos phi sin lambda
    Z = ((1-f)^2 N + h) sin phi  or     f3 = ((1 -f)^2 N + h) sin phi - Z = 0

    The constants are the radius a = 6378388 and polar flattening f = 1/297 and they enter N = a / sqrt(1 - f (2 - f) sin^2 phi). The ratio Y/X is the tangent of lambda so we can substitute the number lambda right away. Watch the signs of X and Y to get the right signs for cos lambda and sin lambda ! Then f1 = 0 and f3 = 0 are the 2 equations to solve for phi and h.

    Create the Jacobian matrix J of first derivatives of f1 and f3 (the 2 components of f) with respect to phi and h. Then Newton's method solves for the changes delta phi and delta h (the 2 components of delta)

    J times delta = minus f where f = [f1 f3]' is computed at the current guess for phi and h

    This gives [phinew hnew] by subtracting inv(J) times current f from the current values of phi and h

    Professor Borre chose the coordinates of his GPS Center in Denmark:

    X = 3 426 949.397 Y = 601 195.852 Z = 5 327 723.994

    You could experiment by starting near the correct values that we know: phi = 57.03....degrees lambda = 9.95...degrees h = 56.95... But Newton didn't work and we are looking for the bug -- if you get a working code I am impressed and happy.

    Solutions to #5 (Due to Areg Hayrapetian) + Fractal basins picture (Thanks to Jason Boggess)

  • The Exam 1 average is 79. Solutions can be found here.

  • Homework 4 due WED October 6

    2.3: 7, 8, 9, 18, 24;
    2.4: 3, 7, 8, 9, 17, 18

    Solutions to #4

  • Homework 3 due WED September 29
    (late homeworks go in the holder outside 2-240)

    1.6: 16, 20, 24, 27, 28;
    2.1: 5, 6, 7, 8;
    2.2: 5, 6, 8

    First Matlab assignment:

    Find the displacements x(1),...,x(100) of 100 masses connected by springs all with c = 1. You may take each force f(i) = .01 and consider two boundary conditions at the bottom:

    (a) Spring 101 connects the last mass to a support as in Figure 2.1
    (b) Mass 100 hangs free at the end of the line of springs.

    Submit GRAPHS of the displacements in these two cases.

    Here are a few MATLAB hints, mostly correct:
    d = ones(100,1) is a column vector of 100 ones and diag(d) is a diagonal matrix (in fact I) with d on the diagonal. diag(d,1) puts d on an off-diagonal, maybe this matrix has order 101. After computing the vector x try
    plot(x,'+')
    xlabel('mass number')
    ylabel('displacement')
    print

    Solutions to #3 (Due to Areg Hayrapetian)

  • Homework 2 due WED September 22
    When Hwk 1 is returned, you will have a class number to put on page 1 of all homeworks to help the graders. THANK YOU. Homeworks are not tests -- you can discuss with anyone including the TAs.

    1.2: problem 1;
    1.3: 1, 9, 18;
    1.4: 1, 4, 7, 11;
    1.5: 3, 4, 8, 9, 13;
    1.6: 2, 8

    Solutions to #2 (Many thanks to Areg Hayrapetian for allowing us to post his excellent solutions!)

  • Homework 1 due WED September 15
    Problems from the textbook:
    1.1: (see math.mit.edu/cse) 1, 5, 9, 12, 26 and 1.2: 7, 16, 18, 21

    This first homework will not be graded -- we will use it to make up the class list. Can you PRINT your name clearly -- and staple the pages (I will bring a stapler ...) I am happy if you discuss all homeworks with friends and write your own solutions. For small Matlab problems you can write the solution or print from the computer.

    Solutions to #1