\def\list#1{{\par\smallskip\leftskip=3pc\parindent=0pt\parskip=0pt \let\\=\par #1\par\smallskip}} \centerline{\bf CS/MATH 3414 Homework \# 13}\bigskip \item{(10) 1.}A second order accurate finite difference approximation to the solution $u(x)$ of the linear two-point boundary value problem \def\7{7\pi}$$\displaylines{u''-\7\cos(\7x)u'+(\7)^2\sin(\7x)u= -(\7)^2\sin(\7x),\qquad 0\le x\le1,\cr u(0)=u(1)=0,\cr}$$ is given by the solution $U$ to the linear system $AU=D$:$$\eqalign{&\bigl[ -\7\cos(\7x_i)h/2-1\bigr]U_{i-1} + \bigl[2-(\7h)^2\sin(\7x_i)\bigr]U_i \cr &\qquad + \bigl[\7\cos(\7x_i)h/2-1\bigr]U_{i+1}=(\7h)^2\sin(\7x_i) ,\qquad i=1,\ldots,n,\cr}$$ where $$h={1\over n+1},\quad x_i=ih,\quad U_0=U_{n+1}=0,\quad u_i=u(x_i),\quad U_i=u_i+{\cal O}(h^2).$$ Solve $AU=D$ for $n+1=25$, 50, 100, 200, 400, 800, and plot the solution vectors $U$. The exact solution satisfies $u(.5)=1/e-1$. Comment (one well written paragraph) on these plots and what you believe is the accuracy of your computed solutions. \item{(10) 2.}{\bf(Extrapolated finite differences.)} Consider again the two-point boundary value problem above. An analysis of the finite difference approximation $U$ shows that $$u_i=U_i+a_2h^2+a_4h^4 +a_6h^6+\cdots,$$ where the coefficients $a_i$ are independent of $h$. With $n+1=50$, 100, 200, 400, solve $AU=D$ and estimate $u(.5)$ using extrapolation to the limit. Compare the four finite difference approximations, the extrapolated value $\hat u(.5)$, and the exact value $u(.5)$. As before, use DGTSV (LAPACK) to factor and solve $AU=D$. \item{(10) 3.}{\bf(Shooting.)}Consider the initial value problem (IVP) \def\7{7\pi}$$\displaylines{u''-\7\cos(\7x)u'+(\7)^2\sin(\7x)u= -(\7)^2\sin(\7x),\qquad 0\le x\le1,\cr u(0)=0,\qquad u'(0)= \alpha.\cr}$$ Denote the solution by $u(x;\alpha)$. Observe that the two-point boundary value problem is equivalent to finding a value of $\alpha$ such that $$f(\alpha)=u(1;\alpha)=0.$$ $f(\alpha)$ is a highly nonlinear function defined only implicitly by solving an IVP. Using root finding and IVP software, find $\alpha$ such that $|f(\alpha)|\le10 ^{-10}$. Now compute $u(.5)$ with this $\alpha$ and compare it with the values obtained in problem 1. Compare the time (human and computer) required by extrapolated finite differences and shooting. %The subroutines ROOT (HOMPACK), ZEROIN (CS3410), RKF (CS3410), and %DDRIV2 (Kahaner) should be useful to you. \medskip\hrule\medskip Use GAMS to retrieve one of the ODE IVP software modules in search class I1a1a or I1a1b. You will also need to use a root solving software package such as ROOT (HOMPACK) or ZEROIN (CS3410). A brief description of GAMS is included with this homework assignment. GAMS existed before the World Wide Web, and was available to run in both X-windows and non-X-windows environments. For historical interest, here is a description of how the preWWW X-windows version of GAMS operated. {\narrower\parindent=0pt To retrieve software modules, use search to select the desired problem class. Before browsing through the modules, set the search filters so that access is free and precision is double. This is accomplished by issuing the following gams commands: \list{filter access free\\filter precision double} \noindent The filters need only be set once while gams is active. Browse through the software modules until you reach a module you wish to retrieve. The commands \list{get documentation\\get fullsource} \noindent retrieve the software module's documentation and software files to your home directory. If you are using xgams, substitue the xgams versions of these commands. }\bigskip GAMS is reached through the World Wide Web at $$\tt http://gams.nist.gov\;.$$ \vfil\eject $$\vbox{\hbox{\vrule \vbox{\hrule\smallskip\hbox{ The GAMS Virtual Software Repository } \smallskip\hrule}\vrule}}$$ The Guide to Available Mathematical Software (GAMS) project of the National Institute of Standards and Technology (NIST) studies techniques to provide scientists and engineers with improved access to reusable computer software which is available to them for use in mathematical modeling and statistical analysis. One of the products of this work is an on-line cross-index of available mathematical software. This system also operates as a virtual software repository. That is, it provides centralized access to such items as abstracts, documentation, and source of software modules that it catalogs; however, rather than operate a physical repository of its own, GAMS provides transparent access to multiple repositories operated by others. Currently GAMS indexes four software repositories: NIST Cray (GRANTA), NIST Convex (TIBER), NIST Suns (CAMSUN), and NETLIB, a public-domain software collection of Oak Ridge National Laboratory and AT\&T Bell Labs. Among the packages cataloged in GAMS are : the IMSL, NAG, PORT, and SLATEC libraries; the BLAS, EISPACK, FISHPAK, FNLIB, FFTPACK, LAPACK, LINPACK, and STARPAC packages; the DATAPLOT and SAS statistical analysis systems; as well as other collections such as the Collected Algorithms of the ACM. Note that although GAMS catalogs both public-domain and proprietary software, source code of proprietary software products are not available through GAMS, although related items such as documentation and example programs often are. All problem-solving software modules in GAMS are assigned one or more problem classifications from a tree-structured taxonomy of mathematical and statistical problems. Users can browse through modules in any given problem class. To find an appropriate class, one can utilize the taxonomy as a decision tree, or enter keywords which are then mapped to problem classes. Search filters can be declared which allow users to specify preferences such computing precision, programming language and access type (i.e., free or proprietary). In addition, users can browse through all modules in a given package, or all modules with a given name. Complete documentation on using the GAMS system is available within the system itself. Please report any problems to gams@cam.nist.gov. We are always interested in hearing suggestions for improving the system. \list{Computing and Applied Mathematics Laboratory \\National Institute of Standards and Technology \\Gaithersburg, MD 20899 USA} Disclaimers : (1) GAMS catalogs mathematical and statistical software that has been made available for use by NIST staff. Identification of commercial products in GAMS does not imply recommendation or endorsement by NIST. (2) Not all software available at the repositories indexed by GAMS is retrievable using GAMS. \vfil\eject