Shampine, Allen, Pruess - Fundamentals of Numerical Computing (523185), страница 53
Текст из файла (страница 53)
Write this in the formwhich can be integrated to get the second integralrelationTo determine c2, evaluate the first relation at x = 1and use the initial conditions to getc2 = A3 - A2 sin 1 - A1 cos 1 + 1.Evaluate the second integral relation at x = 1 to getand we haveY´1(t) = Y 2(t) + Y 1(t) - Y 13(t)/3Y´ 2 (t) = - Y 1 ( t ) .To plot the solution in the phase plane, it isnecessary to plotx´(t) = Y2(t) - G(x(t)) = Y2(t) - G(Yl(t)) againstx(t) = Yl(t). With Y1(0) = -1 and Y2(0) = 1 for0 < t < 15 the resulting phase plane plot is shownbelow.
The closed curve was traced over in thecomputation so that (to plotting accuracy) the limitcycle was obtained.The following sample results were generated byRke with the residuals computed for each integralrelation.xy(x)y´(x)y´´(x)First res.Second res.1.5000001.6472531.6294171.4682841.94E-6-3.92E-72.0000002.6426952.3160411.0107497.32E-6-4.80E-6ANSWERS TO SELECTED EXERCISES6.23 (a)t0.002.004.006.008.0010.0012.00x(t)0.100001.39122-1.95327-1.581420.396771.711020.66878c(t)0.100001.754782.57504-0.11364-3.148580.405873.04524solving the two problems separately.
By using afixed step h = 2/2k we guarantee that x = 0 is amesh point, so convergence is 0(h4) with thefourth order Runge-Kutta code; in contrast, x = 0cannot be a mesh point for h = 2/3k, soconvergence will occur at a slower rate.6.27 The missing initial condition is y´(0) = 2.155796;the following table gives the solution at a fewvalues.x0.00.20.40.60.81.0The period appears to be approximately 9.Miscellaneous Exercises for Chapter 6 (Page249)6.25 Clearly f(x,y) = 2|x|y is continuous on [-1,1];also, fY = 2|x| < 2, so f satisfies a Lipschitzcondition with constant L = 2.
The hypotheses ofTheorem 1 are satisfied. Let y(x) be defined by265y(x)0.0000000.4343370.8915671.4087632.0559723.000000y´(x)2.1555802.2058392.3960982.8303323.7634356.0677516.29 (a) The exact solution is x(t) = 20t - 5000,u(t) = -2.6 × 106exp[2 × 10-5(t - 2000)] + 50t +0.25 × 107. Rke producesx (0) = -5000.00so that y(-l) = e-1 andanda (0) = 1947.46,Thus, y´ is continuous on [-1, 1]. Also, for xpositive or negative y´ = 2|x|y, so that y does satisfythe differential equation. Sincewe have y´´(0+) = 2 while y´´(0-) = -2, so y´´ isnot continuous at x = 0. Euler’s method isconvergent for this problem but not 0(h). Higherorder Runge-Kutta methods will not improveconvergence past 0(h2). If the problem is split atx = 0, then y(x) is infinitely differentiable on eachof [-1, 0] and [0, 1].
If, in the original problem, amesh point is placed at x = 0, this is equivalent towhich are both correct.(c) If FORTRAN is used, the program should bewritten so that Spcoef is called only once by thedriver. The vectors X, F, B, C, and D should bepassed through a COMMON statement to theroutine defining the differential equation. In C andC++ these will have to be global variables. Theoutput is given in the following table.1000150020002500497.291109.421950.423030.9427884.6016736.781656.81-7811.70PreviousINDEXAbsolute error, 1Accuracyof linear system algorithms, 48-61of polynomial interpolation, 98-101of quadrature, 184-187of spline interpolation, 111-113Adams-Bashforth formula, 241Adams-Moulton formula, 242Adams methods, 240-243Adapt (code), 188-189Adaptive quadrature, 184-188AVINT, 201Back substitution, 35,41Backward differentiation formulas, 243Backward error analysis, 49Band matrix, 65Base of a number system, 9Bilinear polynomial, 122-123Binary search, 138Bisection method, 138Bracket, 138Breakpoints, 101C (language), viC++, viCancellation error, 16Chebyshev interpolating points, 88Chopped arithmetic, 7Composite trapezoid rule, 181Conditioning, 1of a linear system, 55-61,of a nonlinear equation, 158Condition number, 56Condition number inequality, 57Cubic spline, 103-115266Curve drawing, 130-131Dawson’s integral, 190, 212, 217-218Degree of precision, 172Determinant, 6, 62, 81Diagonally dominant matrix, 65Differential equations, 210-215Divided differences, 93-98Divided difference table, 95-96Elimination (see Gaussian elimination)End conditions, 108England (see Runge-Kutta-England method)Error in polynomial interpolation, 88-93, 98-101Error in spline interpolation, 102-103, 112Error estimationin Adapt, 184-187in Rke, 230-235Euler’s method, 217Euler-Maclaurin formula, 181Extrapolation, 183Factor (code), 61Filon quadrature, 26, 128-130Floating pointdistribution, 10-11notation, fl(x), 7number system, 9representation, 9FORTRAN 77, viFortran 90, viFundamental Theorem of Integral Calculus, 253Galerkin’s method, 72, 170Gamma function, 13-14GAMS, viiHomeINDEXGaussian elimination, 32-42Gaussian quadrature, 177Gauss-Seidel method, 76Global error (for ODE’s), 228Heun’s method, 225Higher order systems of differential equations, 214-215IEEE arithmetic, 10Ill-conditioned, 2Initial value problem, 210-211Integration by parts, 253Intermediate Value Theorem, 252InterpolationC2 cubic spline, 106-113error, 85-93, 98-101, 102-103, 112in the plane, 119-127inverse, 148polynomial, 82-101shape preserving spline, 104-106Inverse matrix, 31, 63Iterative refinement, 55Jacobi iteration, 76Knots, 101Lagrange form, 83LAPACK, 66, 70Linear system, 30LINPACK, 66, 70Lipschitz condition, 211Lipschitz constant, 211Local error, 222, 228-231, 233-235Loss of significance, 16Lotka-Volterra equation, 163Lower triangular matrix, 44LU factorization, 44-48Maclaurin series, 253-254Mantissa, 4MATHCAD, 136, 147, 155, 183, 244, 248Mathematica, vi, 244MATLAB, vi, 27, 150, 151, 157, 244Matrix, 30Mean Value Theorems, 252Midpoint rule, 178Minimum curvature property, 111Modification of right-hand-side, 40Muller’s method, 147Multiple root, 134Multistep method, 240-244Natural cubic spline, 110, 112Natural end condition, 110Netlib, viiNewton-Cotes formulas, 174Newton divided difference form, 95Newton’s methodfor a single equation, 140for systems, 160-162Nodes, 83Nonlinear equationsscalar, 134-160systems of, 160-162Nonsingular matrix, 30Normalized floating point number, 4, 9Norms, 53Numerical integration (see Quadrature)One-step methods, 221-223Order, 221Oscillatory integrand, 192Overflow, 5Partial pivoting, 39Periodic end conditions, 108Periodic integrand, 181-182, 192-193Piecewise polynomial, 101Pivot, 35Poisson’s equation, 72Pole, 136Polynomial interpolation, 83-98Positive definite matrix, 65267268INDEXQUADPACK, 184, 186-187Quadratic convergence, 141Quadratic equation, 17Quadrature formula, 172Relative error, 1Residualof a linear system, 22, 51of a nonlinear equation, 136Right-hand-side vector, 30Rke (code), 236-238RKSUITE, 244Rolle’s theorem, 252Romberg integration, 183Root, 134of a nonlinear system, 160of a quadratic, 17of a single function, 134Rounded arithmetic, 7Runge-Kuttaclassical, 226England method, 231-233formulas, 224-227Runge’s function, 91, 93Secant method, 140Simple root, 134Simpson’s rule, 177Singular integrand, 193-198Singular matrix, 30Solve (code), 62Spline-coeff (code), 113-115Spline-value (code), 113-115Spline, 101complete cubic, 110, 200shape preserving, 104-106, 200-201Stability, 2Stiff diffferential equation, 243Stirling’s approximation, 14, 206-207Symmetric matrix, 70Systems ofdifferential equations, 212-214linear equations, 30-31nonlinear equations, 160-162Tabular data, integration of, 200-201Taylor series, 223, 252Taylor’s theorems, 252-253Trapezoid rule, 176Triangular matrix, 35Tridiagonal matrix, 68Underflow, 5Undetermined coefficients, 175Unit roundoff, 9Unstable, 2Upper triangular matrix, 35Weightfunction, 171-173quadrature, 171Well-conditioned, 1Wilkinson polynomial, 158-159Yvalue (code), 236-238Zero (code), 152-155Zero (see root).