## Description

- Linear algebraic equations can arise in the solution of differential equations.For example, the following
*heat equation*describes the equilibrium temperature*T*=*T*(*x*)(^{o}C) at a point*x*(in meters m) along a long thin rod,

*, *(1)

where *T _{a }*= 10

^{o}C denotes the temperature of the surrounding air, and

*h*

^{0 }= 0

*.*03(m

^{−2}) is a heat transfer coefficient. Assume that the rod is 10 meters long (i.e. 0 ≤

*x*≤ 10) and has boundary conditions imposed at its ends given by

*T*(0) = 20

^{o}C and

*T*(10) = 100

^{o}C.

- Using standard ODE methods, which you do not need to repeat here, thegeneral form of an analytic solution to (1) can be derived as

*T*(*x*) = *A *+ *Be ^{λx }*+

*Ce*

^{−λx}

*,*(2)

where *A*, *B*, *C*, and *λ *are constants. Plug the solution of type (2) into both sides of equation (1). This should give you an equation that must be satisfied for all values of *x*, for 0 ≤ *x *≤ 10, for some fixed constants *A*, *B*, *C*, and *λ*. Analyze this conclusion to determine what the values of *A *and *λ *must be.

- Next, impose the boundary conditions
*T*(0) = 20^{o}C and*T*(10) = 100^{o}C to derive a system of 2 linear algebraic equations for*B*and*C*. Provide the system of two equations you have derived. - Use one of the numerical algorithms you developed for homework 3 (Gausselimination
*or*LU decomposition) to solve the algebraic system you derived in question 2(b) above, and obtain an*analytic solution*to (1) of the form (2). By*analytic solution*we mean an explicit solution to equation (1) which is valid for each*x*in the interval [0*,*10]. - Next we will discuss how to obtain a
*numerical solution*to (1). That is, we will seek to obtain an approximate solution to (1) which describes the value of*T*at 9 intermediate points inside the interval [0*,*10]. More precisely, the equation (1) can be transformed into a linear algebraic system for the temperature at 9 interior points*T*_{1 }=*T*(1),*T*_{2 }=*T*(2),*T*_{3 }=*T*(3),*T*_{4 }=*T*(4),*T*_{5 }=*T*(5),*T*_{6 }=*T*(6),*T*_{7 }=*T*(7),*T*_{8 }=*T*(8),*T*_{9 }=*T*(9), by using the following finite difference approximation for the second derivative at the*i*^{th }interior point,

*, *(3)

where 1 ≤ *i *≤ 9, *T*_{0 }= *T*(0) = 20^{o}C, *T*_{1}0 = *T*(10) = 100^{o}C, and ∆*x *is the equal spacing between consecutive interior points (i.e. with 9 equally spaced interior points inside [0*,*10] it holds that ∆*x *= 1). Use (3) to rewrite (1) as a system of 9 linear algebraic equations for the unknowns

*T*_{1}*,T*_{2}*,T*_{3}*,T*_{4}*,T*_{5}*,T*_{6}*,T*_{7}*,T*_{8}*, *and *T*_{9}. Provide the system of 9 equations you have derived.

- Use one of the numerical algorithms you developed for homework 3 (Gausselimination
*or*LU decomposition) to solve the system derived in question 1(d) above. Validate your numerical solution by comparison to the analytic solution that you obtained in 1(c) through depicting the two solutions on plots over the interval 0 ≤*x*≤ 10. - Write a function that takes as input the number of interior nodes
*n*desired for your numerical solution (i.e.*n*= 9 in 1(d) above), and outputs the numerical solution to (1) in the form of the interior node values*T*_{1 }=*T*(∆*x*),*T*_{2 }=*T*(2∆*x*)*,…*,*T*=_{n }*T*(*n*∆*x*). - Produce and submit 4 plots that compare your analytic solution to (1) derived in question 2(b) to the numerical solution generated in question 2(f) for
*n*= 1,*n*= 4,*n*= 9, and*n*= 19, respectively.

- Develop an algorithm that uses the golden section search to locate the minimum of a given function. Rather than using the iterative stopping criteria we have previously implemented, design the algorithm to begin by determining the number of iterations
*n*required to achieve a desired absolute error |*E*| (not a percentage), where the value for |_{a}*E*| is input by the user. You may gain insight by comparing this approach to a discussion regarding the bisection method on page 132 of the textbook. Test your algorithm by applying it to find the minimum of with initial guesses_{a}*x*= 1 and_{l }*x*= 5 and desired absolute error |_{u }*E*| = 0_{a}*.* - Given
*f*(*x,y*) = 2*xy*+ 2*y*− 1*.*5*x*^{2 }− 2*y*^{2},- Start with an initial guess of (
*x*_{0}*,y*_{0}) = (1*,*1) and determine (by hand is fine) two iterations of the steepest ascent method to maximize*f*(*x,y*). - What point is the steepest ascent method converging towards? Justifyyour answer without computing any more iterations.

- Start with an initial guess of (