Exam #2

Methods of Engineering Analysis ENCH620

Fall 2002


Instruction

You may use one 8.5''x11'' sheet of notes. Any act of academic dishonesty will not be tolerated. Show your work when appropriate. Set up equations; do the algebra only when time permits or when you judge it to be critical. Remember, you are not being tested on your ability to reduce 2*2 to 4. Since time is limited, keep your answer succinct.
  1. (10 pts.) Linear Independence.

    1. The angle between two vectors x1 and x2 is nonzero. Are x1 and x2 necessarily linearly independent?

      Solution: Yes. If x1 and x2 are linearly dependent, we can express x2 as a scalar multiple of x1.

        x2 = a*x1
      
      And the angle between x1 and x2 is zero.
        q = cos-1[(x1,x2)/(|x1|/|x2|] = cos-1[(x1,a*x1)/a*(x1,x1)]
        q = cos-1[1] = 0
      

    2. Furthermore, the angle between two vectors x1 and x3 is nonzero and that between x2 and x3 is also nonzero. Are x1, x2, and x3 necessarily linearly independent?

      Solution:

      No, all three vectors may all lie in the same "plane".

    3. In a previous homework assignment, we attempted to construct a set of mutually orthogonal functions in x=[0, 1] from the following five Bessel's functions:
         fi(x)=J0(lix)
      where li=i   for i=1,2,..,5
      
      Are these Bessel's functions J0(lix) linearly independent?

      Solution:

      Yes, they are linearly independent from the point of view of pure mathematics. However, no, they are linearly dependent from engineering mathematics. Specifically, out of the five functions, there are only three numerically significantly independent ones in that homework assignment. Many students constructed the last two vectors from computational artifacts (i.e., numerical errors.)

  2. (10 pts.) Orthogonal vectors.

    1. Construct a set of mutually orthogonal functions in x=[-1, 1] from the following functions.
        f0(x)=1
        f1(x)=x
        f2(x)=x2
      

      Solution:

      First, we need to define a scalar product between two functions f(x) and g(x).

                ó1
        (f,g) = ô  f(x)*g(x)*dx
                õ0
      
        (f,g) = integral (from -1 to 1 of f(x)*g(x)*dx)
      
      Follow the Gram-Schmidt orthogonalization process. First, take any one of the given function as the starting vector.
        g0 = 1
      
      Take the second given function, and subtract from it the part that is in the g0 direction. The remaining component is orthogonal to g0
        g2 = x - (x,g0)/(g0,g0)*g0
          = x - 0/2*1
          = x
      
      Take the third given function, and subtract from it the parts common to g1 and g2. The remaining component is orthogonal to both g1 and g2.
        g2 = x2 - (x2,g0)/(g0,g0)*g0 - (x2,g1)/(g1,g1)*g1
          = x2 - (2/3)/2*1 - 0/(2/3)*x
          = x2 - 1/3
      

    2. Is it possible to construct a set of mutually orthogonal functions from the following functions?
        f0(x)=1
        f1(x)=x
        f2(x)=x2
        f3(x)=3x+x2
      

      Solution:

      No. We need to start with a set of linearly independent set of vectors to generate a set of orthogonal vectors (which are linearly independent). In this case, it is not possible to construct a complete set or mutually orthogonal functions because the last function is a linear combination of the previous functions.

  3. (20 pts.) Target of Secret Service. The greenish ink on a $100 bill has a color spectrum given by f(l), where l=[400nm 700nm] is the visible wavelength. You try to counterfeit $100 bills with 5 different types of ink, each of which is characterized by a color spectrum of f1(l), f2(l),..., f5(l). Find the proportion of each ink you should mix together to best approximate the color on a $100 bill. How do you modify the mixing proportion if human color perception is wavelength dependent and is described by a weighting factor w(l)?

    Solution:

    We represent f(l) as a linear combination of fi(l), i=1,2,...,5. We further assume that we cannot produce each given color by mixing the rest, i.e., fi's are linearly independent.

      f(l) = a1*f1(l) + a2*f2(l) + ... + a5*f5(l) + error
      error = f(l) - a1*f1(l) - a2*f2(l) - ... - a5*f5(l)
      Minimize |error|
    
    The best approximation is the projection of f onto the subspace spanned by (f1(l), f2(l),..., f5(l)). The length of error, |error|, is minimized if error is orthogonal to each of the fi's.
      0 = (error,f1) = (f,f1) - a1*(f1,f1) - a2*(f2,f1) - ... - a5*(f5,f1)
      0 = (error,f2) = (f,f2) - a1*(f1,f2) - a2*(f2,f2) - ... - a5*(f5,f2)
      0 = (error,f3) = (f,f3) - a1*(f1,f3) - a2*(f2,f3) - ... - a5*(f5,f3)
      0 = (error,f4) = (f,f4) - a1*(f1,f4) - a2*(f2,f4) - ... - a5*(f5,f4)
      0 = (error,f5) = (f,f5) - a1*(f1,f5) - a2*(f2,f5) - ... - a5*(f5,f5)
    
    We solve the above 5 equations for the 5 coefficients (a1, a2, ..., a5). The above set of equations are linear wrt the coefficients and can be compacted into,
      P*a=F  --->Solve--->  a=P-1*F
    
    where P and F are the various scalar products.
      Pij=(fi,fj)  and   Fi=(f,fi)
    
    Since spectra of inks are not necessarily mutually orthogonal, (fi,fj)¹0 in general. Of course, when the given ink colors are mutually orthogonal, all the off-diagonal elements of P vanishes.
      Pij=(fi,fj)=0   for i¹j
    
    and the regression equation for a is greatly simplified.
      For orthogonal fi,   ai=(f,fi)/(fi,fi)
    
    We can define a suitable scalar product for l=[a,b]=[400nm, 700nm]. For example, the following is a valid one.
              ób
      (f,g) = ô  w(l)*f(l)*g(l)*dl
              õa
    
    With the above definition, the elements of P are,
                   ób
      Pij=(fi,fj) = ô  w(l)*f(l)i*f(l)j*dl
                   õa
    
    In practice, we cannot have negative quantity of ink; thus, the coefficients ai are physically constrained to be nonnegative. (Always relate back to physical reality.)

  4. (20 pts.) From a table of scores of the various categories and other potentially pertinent information in a class (like the one below), find how the overall score (thus, the final semester grade) in ENCH620 is determined. In other words, outline the steps and list the equations employed in developing a model to predict the final grade from the performance in the various categories. Note that the numbers in some of the categories (columns) are highly correlated.
      -------------------------------------------------------------------
      Final  Overall  HW   Exam  Exam  Exam    Class     Seat
      Grade   Score  Total  #1   #2    #3   Attendance  Row #   Sex  ...
      -------------------------------------------------------------------
       A      0.91    40    29    70    69      100       4      M   ...
       B      0.75    45    :     :      :       :        :      :    :
       C       :      :     :     :      :       :        :      :    :
       F       :      :     :     :      :       :        :      :    :
       :       :      :     :     :      :       :        :      :    :
      -------------------------------------------------------------------
    

    Solution:

    This is similar to a previous homework assignment where we attempt to predict national ranking scores from the various factors via linear regression in eigenvector directions. Note that since the independent variables may be highly correlated, plain linear regression does not work.

    1. Assign numerical values to non-numerical entries, e.g., -1 for female and 1 for male; 4 for grade "A", 3 for grade "B", etc.
    2. Mean-center and variance-scale (optional) each of the variables.
    3. Form a nxm matrix of independent variables X, where n is the number of students and m is the number of independent variables.
    4. Find eigenvalue and eigenvectors of the variance matrix XT*X.
    5. Form score vectors score in the eigenvector direction v<i>.
        score<i>=X*v<i>
      
    6. Regress course score y against score vector score<i>, starting with that which corresponds to the largest eigenvalue.
        y = a1*score<1> + a2*score<2> + ... + ai*score<i> + error<i>
      
      where the coefficients ai are given by the projection formula,
        ai = (y,score<i>)/(score<i>,score<i>)   for i=1,2,...
        ai = (y,score<i>)  for i=1,2,...    if score<i> is normalized, i.e., (score<i>,score<i>)=1 (which is usually not)
      
    7. Calculate the error vector and the sum of squared error (sse) or the coefficient of correlation (r2) as we include each additional factor to the regression equation.
        Before we include any factor:
          error<0> = y
          sse0=(error<0>,error<0>)
        As we include each additional factor:
          error<i> = error<i-1> - ai*score<i>
          ssei=(error<i>,error<i>)
      
    8. When sse ceases to decrease significantly as we add an additional factor, we have reached sufficient number of factors in the regression. Stop regression! It is important that we do not over-fit and start to capture noise, rather than the true underlying trend. Remember, it is always possible to drive sse to exactly 0 by increasing the number of factors, but that is not what we wish to achieve in regression.
    9. Provide the regression equation y as a function of the various variables to predict the overall course score. The combination of the coefficients yields the relative weights given to each variable.
    Of course, in ENCH620, I have already explicitly specified how I plan to calculate students' overall scores. Had we not known the model a priori, the above calculation may conclude that class attendance, seating position, or even sex/race seem to contribute to the overall score. This makes it possible for people to distort, deliberately or unwittingly, facts and statistics to fit their agenda.

  5. (20 pts.) Consider a double derivative operator D2 defined in x=[-1 1].
      D2y = d2y/dx2
    
    1. Is D a transform? Briefly, why?

      Solution: Yes. D transforms a continuous differentiable function y into another function. In goes a function, out comes a function. Strictly speaking, the output function also needs to be continuous differentiable. Thus, the LVS for D is all continuous differentiable functions. For example, y(x)=|x| is excluded from the LVS. D2 does the operation twice.

    2. Is D a linear transform? Briefly, why?

      Solution: Yes. The operator D satisfies both linear properties; do does D2:

        1) Distributive:  D(y+z) = D(y) + D(z)
                          L(y+z) = D2(y+z) = D2y + D2z = L(y) + L(z)
        2) Associative:   D(a*y) = a*D(y)
                          L(a*y) = D2(a*y) = a*D2 = a*L(y)
      

    3. Find the eigenvalues and eigenvectors of D. If we apply boundary condition y(-1)=y(1)=0, how many eigenfunctions are there? Hint: consider sine and cosine functions.

      Solution:

      Eigenvalue-eigenvector for the derivative operator D

        Dy = dy/dx = l*y
      
      From the above equation, we see that the eigenvalues are any value and the eigenvectors are exponential functions:
        For any l', y=exp(l'*x)
      
      If we place the restriction y(-1)=y(1)=0, we have no real solution because a real exponential function is never zero.

      Note that eigenvalue-eigenvector for the double derivative operator L=D2 is different from that of D. Do not confuse L with D.

        L(y) = D2y = d2y/dx2 = l'*y
      
      From the above equation, we see that the eigenvalues for the operator L (but not D) are any real and complex number, and the eigenvectors are exponential functions:
        For any l', y=exp(sqrt(l')*x) and y=exp(-sqrt(l')*x)
      
      When we place further restriction with BC y(-1)=y(1)=0, we have sine and cosine functions.
        For l=1/2*p, 3/2*p, 5/2*p,... y=cos(l*x)
        For l=p, 2*p, 3*p,...         y=sin(l*x)
        where l2=-l'
      

    4. Represent a twice-differentiable function f(x) as a a linear combination of the eigenfunctions.
        f(x) = S aj*fj
      
      Find the coefficients aj.

      Solution:

      Since the eigenfunctions are mutually orthogonal, we apply the projection formula,

        aj = (f,fj)/(fj,fj)
      

    5. Can we approximate f(x)=1 in x=[-1, 1] with a series of sine functions? Briefly, why? Note that sin(px)=0 at x=-1 and x=1; however f(1)=f(-1)=1.

      Solution:

      No. f(x)=1 is even, and sine functions are odd.

    6. Can we approximate f(x)=1 in x=[-1, 1] with a series of cosine functions? Briefly, why?

      Solution:

      No, because cos(np*x) is orthogonal to cos(0*x)=1 for n=1,2,.... However, with a different cosine series, (say, cos(x), cos(2x),..., or say, cos(1/2*p*x), cos(3/2*p*x,),...), yes, we can approximate f(x)=1, although we cannot represent f(x)= 1 exactly with a finite number of terms, because the functions are all linearly independent. (Thus, the answer depends on what "a series of cosine functions" are and how the scalar product is defined. Thus, I grade based on students' explanation.)

    7. Can we approximate cos(x) with cos(n*x) for n=2,3,...?

      Solution:

      Yes. However, we need many terms to approximate cos(x) Again, we cannot represent cos(x) exactly, but approximate we can. Note that as in the last part, the answer is "no" if we try to approximate cos(p*x) in x=[-1, 1] with cos(np*x) for n=2,3,..., because they are mutually orthogonal. Again, when we refer to orthogonality, we need to define first the scalar product.

    8. Can we approximate sin(x) with cos(n*x) for n=0,1,...?

      Solution: No.

  6. (20 pts.) Eigenvalue-Eigenvector. The following partial differential equation (PDE) describes the development of velocity (w) inside a very long vertical cylindrical pipe of radius 1 when we suddenly remove a plug initially placed at the bottom of the pipe at time t=0. The only driving force is gravity. (Hereafter we derive eqns 1 and 2; you may skip the problem description and jump directly to eqns 1 and 2.)
      dw   1  d    dw
      -- = - -- (r --)   B.C. at r=1  w=0  (no slip condition at the pipe wall)
      dt   r dr    dr         at t=0  w=1-r2  (zero initial velocity)
    
    One way to solve the above PDE is by separation of variables, where we assume w(t,r) is a product of two functions: T(t) and R(r). Note that function T depends only on time t, and function R depends only on radial position r.
      w(t,r)=T(t)*R(r)
    
    Substituting the above product into the given PDE yields,
      T'   1  1
      -- = - [- (r*R')']
      T    R  r
    
    In the above ODE, the LHS is a function of t only and the RHS is a function of r only. Thus, the only possibility is for both the LHS and the RHS to be constants.
            T'
      LHS = -- = -l2       ... Eqn (1)
            T
    
            1  1
      RHS = - [- (r*R')'] = -l2    ... Eqn (2)
            R  r
      B.C.: at r=0, R=bound
            at r=1, R=0
    
    1. Eqn 1 is solved by finding the eigenvalue and eigenvector of the first-derivative operator T'. Do it.

    2. Eqn 2 is solved by finding the eigenvalue and eigenvector of the second-derivative operator (r*R')'/r. Note: as described previously, at r=1, R(1)=0. Furthermore, at r=0, R is bound. Do it to find R(r). Hint: apply boundary condition to the Bessel's functions J0(x) and Y0(x).

    3. Let Ti(t) and Ri(r) be the eigenvectors that correspond to the "eigenvalue" li. Find wi.
        wi(t,r) = Ti(t)*Ri(r)
      

    4. If wi(t,r) satisfies the given PDE, a linear combination of wi(t,r) also satisfies the given PDE. Find w(t,r), which is a linear combination of wi.

    5. Finally, express the initial condition w(0,r)=1-r2 as a linear combination of Bessel's functions J0.
        w(0,r)=1-r2=S aj*J0(ljr)
      
      Find aj. Hint: Define a scalar product with an integral from 0 to 1 with a weighting factor of r.

      Solution:

      This is an application of the eigenvalue-eigenvector idea. In solving PDEs and in methods of weighted residuals, we rely heavily on the technique of separation of variables coupled with eigenvalue-eigenvector.


Return to Prof. Nam Sun Wang's Home Page
Return to Methods of Engineering Analysis (ENCH620)

Methods of Engineering Analysis -- Exam #2
Forward comments to:
Nam Sun Wang
Department of Chemical Engineering
University of Maryland
College Park, MD 20742-2111
301-405-1910 (voice)
301-314-9126 (FAX)
e-mail: nsw@eng.umd.edu ©2002 by Nam Sun Wang
UMCP logo