Numerical Method HW Tips12
Numerical Method HW Tips12
An accurate estimate of the heat capacity (CP) for a particular inlet mixture is critical to
an efficient separation, so you decide to carry out a series of heat capacity measurements at
different temperatures in the operating range and fit a polynomial model to compute specific heat
capacity as a function of temperature. To find the polynomial that best fits the data, we seek the
values of the weights di id 0 that give the best fit (in a least squares sense) for the linear system
n
d 0 d1T j d 2T j 2 d nd T j nd CP (T j ), j 1,..., nT
The measured values of the heat capacity have a relative error bound of 0.03 and absolute error
bound of 50 J/(kg-K). Use the 2-norm throughout this problem for consistency. Commented [U2]: Short introductions to the problem statement
can be nice to define your nomenclature and set the stage for your
answers. However, it is not necessary and if you do this limit your
1. description to be as short as possible. MAKE IT LESS THAN a
quarter of a page.
For the case of a square system with nT = nd + 1 there will be values of d that fit the data.
Commented [U3]: Adding lines/spacing can alert the grader to
Express the system as Ad = c, where d contains the weights. Write out the forms of A and c. the start of a new part of the problem. Again, a nice feature but not
necessary.
Matrix-vector form of the polynomial fit for CP(T)
Write the nT equations for specific heat capacity assuming nT = nd + 1:
From this, the forms of A and c can easily be determined: Commented [U4]: Boxing your final answers and giving short
introductory sentences can be very helpful for graders. I suggest you
1 T1 T12 T1nd CP (T1 ) do this.
1 T T2 T2 d
2 n CP (T2 )
2
A 1 T3 T32 T3nd c CP (T3 )
2 C (T )
1 TnT TnT TnT d
n
P nT
1
2.
Let the T measurements be evenly spaced between 273 K and 373 K, using nd = 2,3,…,8 (with
nT = 3,4,…,9) plot cond(A) and norm(A-1) on the same axes as a function of nT.
2
Commented [U6]: The plot is commented well and nicely
labeled. You should do this in your reports. Notice that the quality of
the plot is not very good, you can achieve much better quality in a
variety of ways (please ask Joel for more information on this).
Figure P2.1. Condition Number and norm of inverse for A on a log10 scale as a function of nT
3.
Again for the square system, compute relative and absolute error bounds on d for several values
of nd. Let the T measurements be evenly spaced between 273 and 373 K for the same nT and nd
values in part 2. Plot the relative and absolute error bounds as a function of nT. Note: Express
your error bounds in terms of the relative and absolute error bounds in heat capacity.
A(d Δd) c Δc
Ad AΔd c Δc
Notice the original equation Ad = c, substitute this into the equation above
c AΔd c Δc
AΔd Δc
3
Induced Norm Inequality Proof
The induced norm of matrix A M N by the vector x N is:
Ax
A
x
Ax A x , Δx N : x 0
*Induced norm inequality proof (referenced throughout the following sections) Commented [U8]: This was an example of something given in
the notes that you could have referenced. NOT REQUIRED AND A
WASTE OF TIME. You would still need to give the final boxed
Absolute Error of d equation but you would not have to go through any details.
In order to calculate the absolute error of d Δd , left multiply the above relationship by the
inverse of A
Δd A1Δc
Δd A1Δc
Δd A1 Δc
*Absolute error inequality expression
Relative Error of d
In order to calculate the relative error of d, take the 2-norm of the original matrix equation:
Ad c
Δd A1 Δc
Ad c
4
A1 Δc
Δd Ad
c
A1 Δc
Δd A d
c
Δd Δc
A 1 A
d c
*Relative error inequality expression
2-Norm of Δc
nT
Δc Cp
i 1
i
2
Since each of the measurement error terms, ΔCPi are equivalent, they can be group together nT
times. ΔCP is the absolute measurement error in heat capacity, ΔCP = 50 J/kg-K (Given).
Δc nT Cp 2
Δc nT Cp
J
Δc nT 50
kgK
*2-Norm of the heat capacity error vector
J Δc
Absolute Error: Δc nT 50 Relative Error: 0.03
kgK c
5
The absolute and relative errors for weights d can be calculated using the error inequalities
derived above in part 3:
Δd Δc
Δd A1 Δc A 1 A
d c
J Δd
Δd nT 50 A 1 0.03 A1 A
kgK d
Define the norm of A times the norm of its inverse to be the condition number (cond(A)).
J Δd
Δd nT 50 A 1 0.03 cond ( A)
kgK d
*Used to calculate absolute and relative error bounds of d in terms of the error bounds of c
Figure P2.2. Relative and absolute error of d plotted on a log10 scale as a function of nT
Figure P2.2 shows that the relative error bound of d follows the same trend as the
condition number of A and the absolute error bound of d follows the same trend as the 2-norm of
A inverse. Due to these trends the error bounds of d grow exponentially fast making this
polynomial fit unsuitable for CP as a function of T.
6
4.
Again for the square system, derive an expression bounding the absolute uncertainty of the
specific heat capacity prediction from the fitted d for some arbitrary 𝑇𝑇� between 273 K and 373 K,
for arbitrary nd, and justify the bound. Plot the numerical values for the bounds for the values of
nd and nT above, for 𝑇𝑇�= 300 K.
Assume:
d0
d1
1 T^ ^
T2 T nd
^ d 2 CPPr ed (T^ ) CPTrue(T^ ) CP(T^ )
d
nd
And that there exists some 𝐝𝐝̂ within the error bound on d computed above such that:
d^0
^
d
1
1 T^ T2
^
T nd
^ d^2 C True(T^ )
P
^
d nd
d 0 d^
0
d d^
1 1
1 T^ T2
^ ^
T nd d 2 d^2 C (T^ )
P
^
d nd d nd
Define Δd to be the difference between d and 𝐝𝐝̂ and, T to be the polynomial expansion of T
�.
Substitute these relations into the above equation
^
Td CP(T )
^
Td CP(T )
7
^
CP(T ) T d
^
CP(T ) T A1 Δc
Since ΔCP is a scalar its 2-norm is equivalent to the absolute value of the quantity itself
^
CP(T ) T A1 Δc
Where ΔCP is the difference in the predicted and true heat capacity values
� values substituted into the polynomial fit for CP
T is the row vector of T
A is the temperature matrix representing the CP polynomial fit (part 1)
Δc is the absolute measurement error bound for heat capacity = 50 J/(kg-K)
Commented [U9]: Here is a nice example of a completely
Δc nT Δc (reference part 3 for derivation) summarized equation. I am telling the graders everything they need
to know for the final answer (including defining my terms) while
*Used to calculate absolute uncertainty in predicted CP values referencing above for derivations. If you define things previously, it
is ok to NOT define them again, but remember graders are human
Predicted CP uncertainty at 𝐓𝐓 � = 300 K and make mistakes.
The absolute uncertainty in the predicted CP value (defined as |ΔCP|) plotted versus
nT = 3,..,9 is shown below in Figure P2.3. The values of this plot were obtained using the
condA_norminvA_errorPredCp() function in the submitted paulson_HW2_P2.m file. The
algorithm is discussed in detail in part 2.
8
� = 300 K, the predicted specific heat capacity has an absolute
Figure P2.3 shows that at T
error bound of order 30 which corresponds to a polynomial fit with nine temperature
measurements (nT = 9). These large magnitudes in the predicted CP values are a direct result of
the large-normed T vector and the ill-conditioned A matrix. Together, these parameters
significantly amplify the small absolute error bound in the measured heat capacities. Commented [U10]: I would recommend giving little
descriptions of the plots such as this one so that the plot is not free-
floating in space. You can keep it short and sweet.
5.
For the more general case nT > nd + 1, derive expressions for absolute error bounds for the least-
squares estimates dLS using the relation seen in Homework 0:
AT Ad LS = AT c
Derivation
Starting with the general least-squares estimate equation:
AT Ad LS = AT c
AT A(d LS Δd LS ) AT (c Δc)
AT Ad LS AT AΔd LS AT c AT Δc
AT AΔd LS AT Δc
*Least squares (LS) error equation
Δd LS ( AT A)1 AT Δc
Δd LS ( AT A)1 AT Δc
Using similar ideas to the induced norm inequality (proved in part 4), the RHS norm can be
shown to be less than the product of the individual vectors/matrices norms. This results in:
Δd LS ( AT A)1 AT Δc
*Notes: (1) ||ΔdLS|| is the relative error bound for the least square estimates (dLS)
(2) A and c are equivalent to those defined in part 1
9
6.
Explain the intuitive meaning of the ill-conditioning of this system
For a linear equation, Ax = b, the condition number of matrix A is said defined as the
operator of two norms, cond(A) = ||A|| ||A-1||. The condition number is important when solving
linear equations because it is an indicator as to how much a perturbation in b will alter the
solution vector x. If the condition number is high, small changes in b can create large errors in x.
Such a system is said to be ill-conditioned. This usually implies A has small-valued eigenvalues
making it close to singular (zero-valued determinant) and/or the system is badly scaled.
In this problem, the A matrix equals (part 1):
1 T1 T12 T1nd
1 T T2 2 T2 nd
2
This matrix has a large magnitude discrepancy within each of its columns due to the “Taylor-
series type” polynomial fit for heat capacity (CP) in terms of temperature (T) which has
increasing orders of T from 0 to nd. Since the values of temperature are usually order 3, these
polynomial factors result in extremely large magnitude differences from column to column. This
intuitively means that either the chosen scale for the problem parameters are wrong or the fit for
CP as a function of temperature was a poor choice. For this particular problem, I believe the
polynomial expansion fit was a poor choice since high order functions usually result in large
magnitude terms (Terms >= 1010). Additionally, these values span so many orders that it is
difficult to estimate each term accurately. Moreover, the large-magnitude terms result in an
enormous condition number for A which, in turn, takes the relatively small errors in c and
amplifies them within the solution vector d.
I would recommend choosing a better function to fit CP with respect to T instead of
forcing data into random polynomial expansions and preforming least squares analysis blindly.
This more in-depth analysis would require investigating how these variables normally interact
with each other in various relationships. Hopefully, this newer fit would eliminate the large
magnitude discrepancy between columns; however, rescaling the variables to some small finite
range could also be a viable option (i.e. try using relationships that make the temperature and
heat capacity dimensionless, maybe through the addition of other important parameters).
7.
Use Chebyshev polynomials in place of the Tis to construct matrix A. You can use the MATLAB
function ChebyshevPoly. For better conditioning, scale the temperature so that the Chebyshev
polynomial is evaluated on [-1, 1] by evaluating at (2T - Tlow - Thigh) / (Thigh - Tlow) rather than at
T. Comment on the difference between the error bounds for Tis vs. Chebyshev polynomials on
the rescaled temperature range.
10
Discussion of the Chebyshev polynomial algorithm
The paulson_HW2_P2.m file submitted online accesses a user-written function
(chebyshev_A()), reference for more information regarding the specifics of the algorithm) that
generates a modified matrix A for each specified size (3 through 9). Using the ChebyshevPoly()
MATLAB function a polynomial is generated for every power of T in the assumed fit for CP.
This polynomial is then evaluated at a modified T value on the scale of [-1, 1].
The main idea behind this type of modification is to alter A so that its condition number
is significantly lower effectively reducing the error bounds for the solution vector. The user-
written chebyshev_A() function is just a slightly modified version of the
cond_A_norminvA_errorPredCp() function discussed in detail in part 2 (reference for more
information regarding the framework of this algorithm). The only change to this is inside the
third nested for loop, which no longer stores some power of T to the matrix A, but instead
performs this substitution/evaluation for the chebyshev polynomial discussed in the paragraph
above. From this, it can be seen that a multiple polynomials (evaluated along the altered T scale)
are stored in A which effectively adds more entries to the spanning set of the matrix A.
Additionally, the rescaled temperature reduces the extremely large magnitude values dealt with
in part 2 (i.e. ~2739).
Figure P2.4. Absolute and relative error bounds for d calculated using Chebyshev polynomials
11
Error bound comparison for d
For easier comparison, the relative and absolute errors of d calculated using the full
polynomial expansion (part 2) and Chebyshev polynomials (part 7) are plotted together on
Figure P2.5 below. The full polynomial fit produces an absolute error range for d of ~104 to
~1010 (over nT = 3 to 9) whereas the Chebyshev polynomials produce a range of ~101.75 to ~102.5.
Furthermore, the full polynomial fit produces a relative error range for d of ~105 to ~1026 (over
nT = 3 to 9) whereas the Chebyshev polynomials produce a range of ~10-1.5 to ~10-0.5. This shows
that the both the absolute and relative error bounds for d drop significantly when Chebyshev
polynomials are used in place of the full polynomial expansion to calculate A.
Figure 2.5. Error bounds for d using the full polynomial expansion and Chebyshev polynomials
12
MIT OpenCourseWare
https://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: https://ocw.mit.edu/terms.