Thompson - Computing for Scientists and Engineers (523188), страница 41
Текст из файла (страница 41)
For the first tests of program correctness check out the whi1e loop inthe main program by giving it the escape value, n = 0, and also the forbiddenvalues n > 100 (for MAX = 101 as defined) and n = 1. Then try small datasamples, say n = 2, for which the fit must be exact, so that oymin = 0.(b) Check the reciprocity properties of x on y slopes and y on x slopes when thevalue of lambda is inverted, as discussed in Section 6.3. Also consider large,small, and intermediate values of lambda in order to verify (6.36) and (6.37).(c) Improve your understanding of the dependence of the slopes on the ratio ofx to y weights by generating some of the points on Figure 6.4.
Analytically thedependence is given by (6.45). How closely do your numerical values of theslopes agree with this relation? nAlthough graphical comparison of the fitted line with the data is not provided inStraight -Line Least Squares, your insight into least-squares analyses will besignificantly increased if you make an appropriate program interface to make graphical output of data, weights, and best-fit lines, similarly to Figure 6.2.
Since (as discussed in Section 1.3) the implementation of graphics is very dependent on thecomputing environment, I have not provided such an interface.As an application of the methods for least-squares analyses that you have learnedin this chapter, I suggest that you take from your own field of endeavor a small setof data for which the underlying model relating them predicts a linear relationship,and for which errors in x and y variables may realistically be considered to be in aconstant ratio and of comparable size as a fraction of the data values.
You will findit interesting to process these data using the program Straight -Line Least218LEAST-SQUARES ANALYSIS OF DATASquares, varying to see the effects on the values of slope, intercept, and minimum objective function.In this chapter we have emphasized using analytical formulas to estimate best-fitparameters, especially for straight-line fits (Sections 6.3,6.6), normalization factors(Section 6.4), and for logarithmic transformation of exponentials (Section 6.5). Itis also possible, and often desirable, to remove some of the constraints that we imposed in our least-squares fitting (such as linear parameterizations) by using MonteCarlo simulation techniques to model the distribution of errors, as is suggested inExercise 6.25. With adequate computing power, such techniques can allow forarbitrary distributions of errors and correlations between fitting parameters.
Introductions to such methods, including the “bootstrap” technique, are provided in theScientific American article by Diaconis and Efron, in the article by Kinsella, and inChapters 16 and 17 of Whitney’s book. Application of the bootstrap technique to avery large database of 9000 measurements and their errors, in which there are highlynonlinear relations between parameters and data, is made in a review article byVarner et al.Least-squares methods may be combined with spline methods (Chapter 5) at theexpense of much more analysis and complexity. Smoothing of noisy data maythereby by achieved.
Appropriate methods are described in the article by Woltring.REFERENCES ON LEAST-SQUARES ANALYSISBabu, G. J., and E. D. Feigelson, “Analytical and Numerical Comparisons of SixDifferent Linear Least Squares Fits,” Communications in Statistics — Simulationand Computation, 21, 533 (1992).Barlow, R. J., Statistics: A Guide to the Use of Statistical Methods in the PhysicalSciences, Wiley, Chichester, England, 1989.Beckmann, P., Orthogonal Polynomials for Engineers and Physicists, Golem Press,Boulder, Colorado, 1973.Deming, W.
E., Statistical Adjustment of Data, Wiley, New York 1943; reprintedby Dover, New York, 1964.Diaconis, P., and B. Efron, “Computer-Intensive Methods in Statistics,” ScientificAmerican, 248, May 1983, p. 116.Draper, N. R., and H. Smith, Applied Regression Analysis, Wiley, New York,second edition, 1981.Isobe, T., E. D. Feigelson, M. G. Akrita, and G. J. Babu, “Linear Regression inAstronomy.I,” Astrophysical Journal, 364, 104 (1990).Jaffe, A. J., and H.
F. Spirer, Misused Statistics, Marcel Dekker, New York, 1987.Kinsella, A., “Numerical Methods for Error Evaluation,” American Journal ofPhysics, 54, 464 (1986).Lichten, W., Data and Error Analysis in the Introductory Physics Laboratory, Allynand Bacon, Boston, 1988.REFERENCES ON LEAST-SQUARES ANALYSIS219Lyons, L., A Practical Guide to Data Analysis for Physical Science Students,Cambridge University Press, Cambridge, England, 199 1.Lyons, L., Data Analysis for Nuclear and Particle Physics, Cambridge UniversityPress, New York, 1986.Macdonald, J.
R., and W. J. Thompson, “Least Squares Fitting When Both Variables Contain Errors: Pitfalls and Possibilities,” American Journal of Physics,60, 66 (1992).Reed, B. C., “Linear Least Squares When Both Variables Have Uncertainties,”American Journal of Physics, 57, 642 (1989); erratum ibid, 58, 189 (1990).Siegel, A.
F., Statistics and Data Analysis, Wiley, New York, 1988.Snell, J. L., Introduction to Probability, Random House, New York, 1987.Solomon, F., Probability and Stochastic Processes, Prentice Hall, EnglewoodCliffs, New Jersey, 1987.Taylor, J. R., An Introduction to Error Analysis, University Science Books, MillValley, California, 1982, pp. 166, 167.Thompson, W. J., and J. R. Macdonald, “Correcting Parameter Bias Caused byTaking Logs of Exponential Data,” American Journal of Physics, 59, 854(1991).Thompson, W. J., “Algorithms for Normalizing by Least Squares,” Computers inPhysics, July 1992.Varner, R. L., W. J.
Thompson, T. L. McAbee, E. J. Ludwig, and T. B. Clegg,Physics Reports, 201, 57 (1991).Whitney, C. A., Random Processes in Physical Systems, Wiley-Interscience, NewYork, 1990.Woltring, H. J., “A Fortran Package for Generalized Cross-Validatory SplineSmoothing and Validation,” Advances in Engineering Software, 8, 104 (1986).York, D., “Least-Squares Fitting of a Straight Line,” Canadian Journal of Physics,44, 1079 (1966).220Previous HomeChapter 7INTRODUCTION TODIFFERENTIAL EQUATIONSDifferential equations are ubiquitous in science and engineering.
The purpose of thischapter is to provide an introduction to setting up and solving such differential equations, predominantly as they describe physical systems. Both analytical and numerical techniques are developed and applied.Our approach is to develop the methods of solution of differential equations fromthe particular to the general. That is, a scientifically interesting problem will be castinto differential equation form, then this particular equation will be solved as part ofinvestigating general methods of solution.
Then the more general method of solution will be discussed. This order of presentation will probably motivate you betterthan the reverse order that is typical (and perhaps desirable) in mathematics texts, butquite untypical in scientific applications. You may also recall that in the seventeenthcentury Isaac Newton invented the differential calculus in order to help him computethe motions of the planets. Only later was the mathematical edifice of differentialcalculus, including differential equations, developed extensively.The applications in this chapter are broad; the kinematics of world-record sprintsand the improving performance of women athletes provide an example of first-orderlinear equations (Section 7.2), while nonlinear differential equations are representedby those that describe logistic growth (Section 7.3).
Numerical methods are introduced in Section 7.4, where we derive the algorithms. We present the programs forthe first-order Euler method and of the Adams predictor as Project 7 in Section 7.5.Many examples and exercises on testing the numerical methods are then provided.References on first-order differential equations round out the chapter. Second-orderdifferential equations are emphasized in Chapter 8, which contains further examplesand develops the numerical methods introduced in this chapter.221Next222INTRODUCTION TO DIFFERENTIAL EQUATIONS7.1 DIFFERENTIAL EQUATIONS AND PHYSICAL SYSTEMSWe first survey how differential equations arise in formulating and solving problemsin the applied sciences. In pure mathematics the emphasis in studying differentialequations is often on the existence, limitations, and the general nature of solutions.For the field worker in applied science it is most important to recognize when aproblem can be cast into differential equation form, to solve this differential equation, to use appropriate boundary conditions, to interpret the quantities that appear init, and to relate the solutions to data and observations.Why are there differential equations?In physical systems, such as the motion of planets, the phenomena to which differential equations are applied are assumed to vary in a continuous way, since a differential equation relates rates of change for infinitesimal changes of independent variables.