# Tutorial 6 - 2010 - Solution

### From Process Model Formulation and Solution

Due date(s):
| 28 October 2010 |

(PDF) | Tutorial questions |

(PDF) | Solutions |

Other instructions
| Hand-in at class. |

Tutorial objectives: Lagrange and Newton interpolation; due 28 October.

# Question 1 [2]

Use the heat capacity data in the course slides (slide 5) at \(T = [300, 500, 900]\) K, with corresponding heat capacities \(C_p = [29.85, 30.51, 33.42] \rm J\ mol^{-1}\ K^{-1}\)

Construct the Lagrange interpolating polynomial of order 2 that passes through all three data points. There is no need to simplify the polynomial.

Using this polynomial, compute (i.e. predict) the estimated heat capacity at \(T = 400\) K and \(T = 800\) K. Are the predictions reasonable?

Create a computer plot that shows your polynomial, over the range \(T \in [300, 1600]\) K. Superimpose on this plot the 14 data points from slide 5 in the course notes.

Where is the greatest prediction error in your polynomial? Is this expected?

If you were to construct the Newton interpolating polynomial and estimate the heat capacities at \(T = 400\) K and \(T = 800\) K, what answer would you get? Explain.

## Solution

The second order Lagrange polynomial that approximates the heat capacity function, \(C_p(T)\) has the form:

\[C_p(T) \approx p_2(T) = y_1 \ell_1(T) + y_2 \ell_2(T) + y_3 \ell_3(T)\]where each of the Lagrange cardinal functions, for this case is:

\[\begin{split}\ell_1(T) &= \displaystyle \frac{(T-500)(T-900)}{(300-500)(300-900)} \\\ell_2(T) &= \displaystyle \frac{(T-300)(T-900)}{(500-300)(500-900)} \\\ell_3(T) &= \displaystyle \frac{(T-300)(T-500)}{(900-300)(900-500)}\end{split}\]So the Lagrange polynomial approximation is:

\[C_p(T) \approx = \displaystyle 29.85 \cdot \frac{(T-500)(T-900)}{120000} + 30.51 \cdot \frac{(T-300)(T-900)}{-80000} + 33.42 \cdot \frac{(T-300)(T-500)}{240000}\]\(C_p(T=400K) \approx (29.85)(0.4167) + (30.51)(0.625) + (33.42)(-0.04167) = 30.11\) J/(mol.K)

\(C_p(T=800K) \approx (29.85)(-0.25) + (30.51)(0.625) + (33.42)(0.625) = 32.49\) J/(mol.K)

The predictions are within the range of the neighbouring data points, and fall within the upward trend relationship shown between temperature and heat capacity. Further, they are similar (less than 1% error) to the values shown at these data points in the course slides.

The plot shows the 14 data points (black circles), of which 3 (red asterisks) were used to develop the Lagrange polynomial. The polynomial's accuracy is greatest with the range of these 3 points. Above them the accuracy deteriorates very rapidly, indicating the problem with extrapolation.

Importantly, the Lagrange polynomial passes through the 3 source data points.

You get the same answers as in part 2, since the polynomial was created as a second order polynomial passing through 3 data points. This implies the polynomial is unique, and that the Newton form and the Lagrange form of the polynomial, when simplified to \(p_2(x) = a_0 + a_1x + a_2 x^2\), would be identical. There was no need to actually calculate the Newton form for this question.

# Question 2 [1]

The heat of reaction for a specific reaction depends on temperature as follows:

\(T \rm[^\circ C]\) | -250 | -200 | -100 | 0 | 100 | 300 |

\(\Delta H_R \rm[J\ mol^{-1}\ K^{-1}]\) | 160.0 | 318.0 | 699.0 | 870.0 | 941.0 | 1040 |

- Express \(\Delta H_R\) as a 5th-order polynomial using the Newton form of the interpolating polynomials. Report your intermediate results in a chart, as shown in the course material.
- Estimate \(\Delta H_R(T=200 \rm ^\circ C)\) and \(\Delta H_R(T=400 \rm ^\circ C)\) using the Newton polynomials. Comment on the results.

## Solution

Newton interpolating polynomials are best determined using a table format:

\[\begin{split}\begin{array}{rrrrrrr}\hline \hline ~T & \Delta H_R & \text{Two terms} & \text{Three terms} & \text{Four terms} & \text{Five terms} & \text{Six terms}\\-250 & \underline{160.0} & \frac{318-160}{-200-(-250)}=\underline{3.16} & \frac{3.81 - 3.16}{-100-(-250)} = \underline{4.33\times 10^{-3}} & \underline{ -5.933\times 10^{-5}} & \underline{2.219\times 10^{-7}} & \underline{-4.312\times 10^{-10}} \\-200 & 318.0 & \frac{699-318}{-100-(-200)} = 3.81 & \frac{1.71 - 3.81}{0-(-200)} = -1.05 \times 10^{-2} & 1.833\times 10^{-5} & -1.525\times 10^{-8} & \\-100 & 699.0 & \frac{870-699}{0-(-100)} = 1.71 & \frac{0.71 - 1.71}{100-(-100)} = -5.0 \times 10^{-3} & 1.071\times 10^{-5} & & \\ 0 & 870.0 & \frac{941-870}{100-0} = 0.71 & \frac{0.495 - 0.71}{300-0} = -7.167 \times 10^{-4} & & & \\ 100 & 941.0 & \frac{1040-941}{300-100} = 0.495 & & & & \\ 300 & 1040 & & & & & \\\hline \hline\end{array}\end{split}\]Therefore the Newton interpolating polynomial for the data set described in this equation is the following.

\[\begin{split}f(x) &= b_{0}+b_{1}(x-x_{1})+b_{2}(x-x_{1})(x-x_{2})+ \ldots +b_{5}(x-x_{1})(x-x_{2})(x-x_{3})(x-x_{4})(x-x_{5}) \\ &= {\bf 160.0} + {\bf 3.16} (x+250) + {\bf 4.33\times 10^{-3}} (x+250) (x+200) {\bf -5.933\times 10^{-5}} (x+250) (x+200) (x+100) + \nonumber \\ &{\bf 2.219\times 10^{-7}} (x+250) (x+200) (x+100) (x-0) {\bf -4.312\times 10^{-10}}(x+250) (x+200) (x+100) (x-0) (x-100) \nonumber\end{split}\]The requested estimates are: \(f(200) = 1088\) J/(mol.K) and \(f(400) = -447\) J/(mol.K)

The estimate for \(T=200\ \rm ^\circ C\) is somewhat reasonable as it is close to the \(\Delta H_R\) values for the two adjacent temperatures of \(T=100\) and \(T=300\). However, it would be most reasonable if it actually fell between those \(\Delta H_R\) values. This is because the raw data shows a monotonic increase in \(\Delta H_R\) with respect to temperature.

The estimate for \(T=400\ \rm ^\circ C\) does not make sense at all, as it is

*much lower*than the value at \(T=300\ \rm ^\circ C\). Since we see in the raw data that \(\Delta H_R\) increases with temperature, this estimate is clearly not very good. This illustrates the fact that an interpolating polynomial is only good for values within its bounds. Extrapolated estimates should not be relied upon.The figure illustrates what is happening for this case, where the Newton polynomial has been superimposed on the raw data (circles) and the two predictions (asterisks).