\centerline{\bf CS/MATH 3414 Homework \# 9}\bigskip \item{(12) 1.}Computer problem 6.2.11 (page 260) in Cheney and Kincaid. \medskip\hrule\medskip\centerline{\bf Extra Credit}\medskip \def\i#1{\int_0^h#1\,dx} \item{(3) 2.}Find an integration formula of the form $$\i{f(x)}\approx \alpha_0f(0)+\alpha_1f'(0)+\alpha_2f(h)$$ which is exact if $f$ is a polynomial of degree $\le2$. [Hint: Let $L(f)=\alpha_0f(0)+\alpha_1f'(0) +\alpha_2f(h)$. First show that $L(af+bg)=aL(f)+bL(g)$ for constants $a$, $b$ and functions $f$, $g$. Then find $\alpha_0$, $\alpha_1$, $\alpha_2$ such that $L(1)=\i 1$, $L(x)=\i x$, $L(x^2)=\i{x^2}$. It now follows that $L(a\,1+bx+cx^2)=aL(1)+bL(x)+cL(x^2)=a\i 1+b\i x+c\i{x^2}= \i{a+bx+cx^2}$, i.e., $L$ is exact for polynomials of degree $\le2$.] \hangindent=\parindent Mathematica wizardry: define {\tt $$\displaylines{ \hbox{Lop[f\_]}\: \hbox{alpha0 * Derivative[0][f][0]} + \hbox{alpha1 * Derivative[1][f][0]} +\cr \hbox{alpha2 * Derivative[0][f][h]; Attributes[Lop]} =\{\hbox{HoldFirst} \}\cr \hbox{eqn1}= \hbox{Lop[(1)\&]} == \hbox{Integrate}[1, \{x,0,h\}]\cr \hbox{eqn2}= \hbox{Lop[(\#1)\&]} == \hbox{Integrate}[x, \{x,0,h\}]\cr \hbox{eqn3}= \hbox{Lop[((\#1)\char"5E 2)\&]} == \hbox{Integrate}[x^2, \{x,0,h\}]\cr \hbox{Solve[$\{$eqn1, eqn2, eqn3$\}$, $\{$alpha0, alpha1, alpha2$\}$]} \cr}$$} \item{(5) 3.}Find an explicit expression (in terms of $h$ and $f$) for the error in the integration formula of 2. [Hint: $L(f)=\i{({\rm some\ interpolant\ to\ }f)}$. Find that interpolant.] \item{(2) 4.}Compute the first four orthogonal polynomials $\psi_0$, $\ldots$, $\psi_3$ with respect to the inner product $$\langle f,g \rangle=\int_{-1}^1 f(x)g(x)\cos(\pi x/2)\,dx.$$ The relevant Mathematica package is {\tt LinearAlgebra`Orthogonalization`}, containing the functions: $$\displaylines{\hbox{\tt GramSchmidt[$\{v_1,v_2,\ldots\}$, InnerProduct $\to$ {\it pure function}, Normalized $\to$ False],}\cr \hbox{\tt Normalize[$v$, InnerProduct $\to$ {\it pure function}],}\cr \hbox{\tt Projection[$v_1,v_2$, InnerProduct $\to$ {\it pure function}],}.\cr}$$ \vfil\eject