Chapter 10. Numerical Solution Methods for Engineering Analysis

Similar documents
Chapter 3 Differentiation and Integration

OPTIMISATION. Introduction Single Variable Unconstrained Optimisation Multivariable Unconstrained Optimisation Linear Programming

Numerical Solution of Ordinary Differential Equations

ORDINARY DIFFERENTIAL EQUATIONS EULER S METHOD

Finite Difference Method

36.1 Why is it important to be able to find roots to systems of equations? Up to this point, we have discussed how to find the solution to

Summary with Examples for Root finding Methods -Bisection -Newton Raphson -Secant

Numerical Methods. ME Mechanical Lab I. Mechanical Engineering ME Lab I

Lecture 2 Solution of Nonlinear Equations ( Root Finding Problems )

CHAPTER 4d. ROOTS OF EQUATIONS

: Numerical Analysis Topic 2: Solution of Nonlinear Equations Lectures 5-11:

CHAPTER 5 NUMERICAL EVALUATION OF DYNAMIC RESPONSE

Chapter 12. Ordinary Differential Equation Boundary Value (BV) Problems

Numerical Heat and Mass Transfer

EE 330 Lecture 24. Small Signal Analysis Small Signal Analysis of BJT Amplifier

CISE301: Numerical Methods Topic 2: Solution of Nonlinear Equations

Physics 2A Chapter 3 HW Solutions

A new Approach for Solving Linear Ordinary Differential Equations

Single Variable Optimization

Work is the change in energy of a system (neglecting heat transfer). To examine what could

ME 501A Seminar in Engineering Analysis Page 1

Measurement and Uncertainties

CHAPTER 4. Vector Spaces

PART 8. Partial Differential Equations PDEs

Lecture 12: Discrete Laplacian

NUMERICAL DIFFERENTIATION

Section 8.3 Polar Form of Complex Numbers

Shuai Dong. Isaac Newton. Gottfried Leibniz

One Dimensional Axial Deformations

4DVAR, according to the name, is a four-dimensional variational method.

Spring Force and Power

University of Washington Department of Chemistry Chemistry 452/456 Summer Quarter 2014

Bézier curves. Michael S. Floater. September 10, These notes provide an introduction to Bézier curves. i=0

Difference Equations

SIMPLE LINEAR REGRESSION

CSci 6974 and ECSE 6966 Math. Tech. for Vision, Graphics and Robotics Lecture 21, April 17, 2006 Estimating A Plane Homography

Kinematics in 2-Dimensions. Projectile Motion

Resource Allocation and Decision Analysis (ECON 8010) Spring 2014 Foundations of Regression Analysis

Module 3 LOSSY IMAGE COMPRESSION SYSTEMS. Version 2 ECE IIT, Kharagpur

MMA and GCMMA two methods for nonlinear optimization

Note 10. Modeling and Simulation of Dynamic Systems

Complex Variables. Chapter 18 Integration in the Complex Plane. March 12, 2013 Lecturer: Shih-Yuan Chen

Solutions to Problem Set 6

Numerical Methods Solution of Nonlinear Equations

Physics 2A Chapters 6 - Work & Energy Fall 2017

Kernel Methods and SVMs Extension

NON-CENTRAL 7-POINT FORMULA IN THE METHOD OF LINES FOR PARABOLIC AND BURGERS' EQUATIONS

1. Fundamentals 1.1 Probability Theory Sample Space and Probability Random Variables Limit Theories

Numerical Solutions of a Generalized Nth Order Boundary Value Problems Using Power Series Approximation Method

More metrics on cartesian products

EEE 241: Linear Systems

Instituto Tecnológico de Aeronáutica FINITE ELEMENTS I. Class notes AE-245

3.1 Expectation of Functions of Several Random Variables. )' be a k-dimensional discrete or continuous random vector, with joint PMF p (, E X E X1 E X

ECEN 5005 Crystals, Nanocrystals and Device Applications Class 19 Group Theory For Crystals

Chapter 14 Simple Linear Regression

Root Finding

12. The Hamilton-Jacobi Equation Michael Fowler

Solutions to Homework 7, Mathematics 1. 1 x. (arccos x) (arccos x) 1

Grid Generation around a Cylinder by Complex Potential Functions

APPENDIX 2 FITTING A STRAIGHT LINE TO OBSERVATIONS

E91: Dynamics. E91: Dynamics. Numerical Integration & State Space Representation

The Finite Element Method

Chapter 6. Operational Amplifier. inputs can be defined as the average of the sum of the two signals.

COMPARISON OF SOME RELIABILITY CHARACTERISTICS BETWEEN REDUNDANT SYSTEMS REQUIRING SUPPORTING UNITS FOR THEIR OPERATIONS

Uncertainty in measurements of power and energy on power networks

Fall 2012 Analysis of Experimental Measurements B. Eisenstein/rev. S. Errede. . For P such independent random variables (aka degrees of freedom): 1 =

Simultaneous Optimization of Berth Allocation, Quay Crane Assignment and Quay Crane Scheduling Problems in Container Terminals

Week3, Chapter 4. Position and Displacement. Motion in Two Dimensions. Instantaneous Velocity. Average Velocity

Chapter 13: Multiple Regression

RELIABILITY ASSESSMENT

SCALARS AND VECTORS All physical quantities in engineering mechanics are measured using either scalars or vectors.

Chapter 5 Function-based Monte Carlo

Correlation and Regression. Correlation 9.1. Correlation. Chapter 9

Designing of Combined Continuous Lot By Lot Acceptance Sampling Plan

CHAPTER-5 INFORMATION MEASURE OF FUZZY MATRIX AND FUZZY BINARY RELATION

NP-Completeness : Proofs

Integrals and Invariants of Euler-Lagrange Equations

New Method for Solving Poisson Equation. on Irregular Domains

This column is a continuation of our previous column

One-sided finite-difference approximations suitable for use with Richardson extrapolation

FTCS Solution to the Heat Equation

Numerical Differentiation

Chapter Newton s Method

Lecture 13 APPROXIMATION OF SECOMD ORDER DERIVATIVES

The Fundamental Theorem of Algebra. Objective To use the Fundamental Theorem of Algebra to solve polynomial equations with complex solutions

THE SUMMATION NOTATION Ʃ

CIS526: Machine Learning Lecture 3 (Sept 16, 2003) Linear Regression. Preparation help: Xiaoying Huang. x 1 θ 1 output... θ M x M

Lecture 2: Numerical Methods for Differentiations and Integrations

e i is a random error

Module 2. Random Processes. Version 2 ECE IIT, Kharagpur

ELASTIC WAVE PROPAGATION IN A CONTINUOUS MEDIUM

Consistency & Convergence

χ x B E (c) Figure 2.1.1: (a) a material particle in a body, (b) a place in space, (c) a configuration of the body

Med Phys 4R06/6R03 Laboratory Experiment #6 MULTICHANNEL PULSE SPECTROMETRY

ACTM State Calculus Competition Saturday April 30, 2011

Chapter Twelve. Integration. We now turn our attention to the idea of an integral in dimensions higher than one. Consider a real-valued function f : D

THE VIBRATIONS OF MOLECULES II THE CARBON DIOXIDE MOLECULE Student Instructions

Module 14: THE INTEGRAL Exploring Calculus

1 GSW Iterative Techniques for y = Ax

CinChE Problem-Solving Strategy Chapter 4 Development of a Mathematical Model. formulation. procedure

Transcription:

Appled Engneerng Analss - sldes or class teachng* Chapter Numercal Soluton Methods or Engneerng Analss * Based on the tetbook on Appled Engneerng Analss, b Ta-Ran Hsu, publshed b John Wle & Sons, 8 (ISBN 978974) (Chapter Numercal soluton methods) Ta-Ran Hsu

Chapter Learnng Objectves (p.9) Learn the alternatve was o usng numercal methods to solve nonlnear equatons, perorm ntegratons, and solve derental equatons. Learn the prncples o varous numercal technques or solvng nonlnear equatons, perormng ntegratons, and solvng derental equatons b the Runge-Kutta methods. Learn the act that numercal methods oer appromate but credble accurate solutons to the problems that are not readl or possbl solved b closed-orm soluton methods. Learn the act that numercal solutons are avalable to the users onl at the preset soluton ponts, and the accurac o the soluton s largel dependng on the sze o the ncrements o the varable selected or the solutons. Become amlar wth the value o commercall avalable numercal soluton sotware packages such as Mathematca and MatLAB.

. Introducton Numercal methods are technques b whch the mathematcal problems nvolved wth the engneerng analss cannot readl or possbl be solved b analtcal methods such as those presented n prevous chapters o ths book. We wll learn rom ths chapter on the use o some o these numercal methods that wll not onl enable engneers to solve man mathematcal problems, but the wll also allow engneers to mnmze the needs or the man hpotheses and dealzaton o the condtons, as stpulated n Secton.4 (p.8) or engneerng analss. Ths chapter wll cover the prncples o commonl used numercal technques or: () the soluton o nonlnear polnomal and transcendental equatons, () Integraton wth ntegrals that nvolve comple orms o unctons, and () the soluton o derental equatons b selected nte derence methods, (4) overvews o two popular commercal sotware packages called Mathematca and MatLAB.

. Engneerng Analss wth Numercal Solutons (p.4) There are a number o unque characterstcs o numercal soluton methods n engneerng analss. Followng are just a ew obvous ones: ) Numercal solutons are avalable onl at selected (dscrete) soluton ponts, but not at all ponts covered b the unctons as n the case wth analtcal soluton methods. ) Numercal methods are essentall tral-and-error processes. Tpcall, users need to estmate an ntal soluton wth selected ncrement o the varable to whch the ntended soluton wll cover. Unstable numercal solutons ma result rom mproper selecton o step szes (the ncremental steps) wth solutons ether n the orm o wld oscllaton or becomng unbounded n the trend o values. ) Most numercal soluton methods results n errors n the solutons. There are two tpes o errors that are nherent wth numercal solutons: (a) Truncaton errors Because o the appromate nature o numercal solutons, the oten conssts o lower order terms and hgher order terms. The latter terms are oten dropped n the computatons or the sake o computatonal ecenc, resultng n error n the soluton, and (b) Round-o errors Most dgtal computers handle ether numbers wth 7 decmal ponts, or 4 decmal ponts n numercal solutons. In the case o -bt computer wth double precson (.e. 4 decmal ponts length numbers), an number ater the 4 th decmal pont wll be dropped. Ths ma not sound lke a bg deal, but a huge number o operatons are nvolved n the computaton, such error can accumulate and result n sgncant error n the end results. Both these errors are o accumulatve natures. Consequentl, errors n numercal soluton ma grow to be sgncant wth solutons obtaned ater man step wth the set ncrements. 4

. Soluton o Nonlnear Equatons (p.4) We have learned the dstncton between lnear and nonlnear algebrac equatons n Secton 4.. There are numerous occasons that engneers. are requested to solve nonlnear equatons such as the equaton or the soluton t o the ollowng nonlnear equaton n Eample 8.9 on page 7: (.) We reported a soluton o t =.7 n Equaton (.) b a short cut soluton method, and also t =.86 b a more accurate soluton method such as the Newton- Raphson method descrbed n Secton... There are a number o numercal methods avalable to solve nonlnear equatons such as n Equaton (.); what we wll ntroduce here n the book are the ollowng two methods that are readl avalable b usng dgtal computers:.. Soluton usng Mcrosot Ecel sotware (Eample.) (p.4): In ths method, we wll rst epress the equaton n the orm o ()= as shown n Fgure.. For eample, we wll epress Equaton (.) n Eample. rom the orm o 4 - + -=- nto the orm: 4 - + -+=, n whch we wll get the uncton () = 4 - + -+. The roots would le n the range between = and +, wth whch the values o ( ) and ( + ) bearng derent postve or negatve sgn. The derence o ( - ) and ( ), or between + and s reerred to be the ncrement o -value, or s epressed as. Fgure. Roots n Nonlnear Equaton () = 5

.. Soluton usng Mcrosot Ecel sotware (Eample.) Cont d: Eample. Solve the nonlnear polnomal Equaton n (.): 4 - + -+= Soluton: We have Equaton. epressed as ()= wth () = 4 - + -+. We wll use Mcrosot Ecel sotware to evaluate the uncton () wth an ncrement o the varable, =.5 begnnng at =. The values o the uncton () wth ( =,,,.,9) are shown n the Table n the rght, and the plot o uncton () vs. varable s depcted n Fgure. : ()..5.56. 4.5 -.94 5. +. 6.5 9.56 7.. Fgure. 8.5 69/6 9 4. 5. We notce rom the computed values o () wth varable n Fgure. that there are two roots o the equaton n the ranges o (=. and.5) and the other root n the range o ( =.5 and.) because the sgn changes o the uncton () cross these two ranges o varable. The rst root o = s obvous because t resulted n () =. The search o the second root wth computatons o the uncton () wth smaller ncrement o between =.5 and =. ndcated an appromate root at =.8 as llustrated n the plot o the results n Fgure.. 6

.. The Newton-Raphson Method a popular method or solvng nonlnear equatons (p.4) Ths method oers rapd convergence to the roots o man nonlnear equatons rom the ntal estmated roots. Fgure. llustrates the prncple o Newton/Raphson s method n solvng nonlnear equatons. The user needs to estmate a root at = or the equaton () =, rom whch he (she) ma compute the uncton ( ) and at the same tme the slope o the curve generated b the uncton (). Ths slope ma be epressed ( ), as epressed n the ollowng equaton:. ( ) ' (.4) whch leads to the ollowng epresson or the net estmated root at = + to be: ' Fgure. Newton-Raphson Method (.5) One would readl notce rom Fgure. that the computed appromated net root + s much closer to the real root (shown n lled crcle) than the prevousl estmated value at. 7

.. The Newton-Raphson Method-Cont d Eample. (p.4) Use the Newton-Raphson s method to nd the roots o the ollowng nonlnear polnomal equaton: () = 4 - + -+= (a) Soluton: We wll epress the rst order dervatve o () n Equaton (a) that represent the slope o the curve as requred b Equaton (.4): ' 4 6 (b) Substtutng ( ) and ( ) nto Equaton (.5) or the Newton-Raphson method, we wll have the ollowng epresson or ndng the estmate roots begn wth = : ' 4 4 6 6 Thus b estmatng the rst root at = =.5 wth =, we wll have the net estmated value at wth = + b usng Equaton (c) as: 4.5 4.5.5.5.5 6.5 6.5.5.6 B ollowng the same procedure, we wll nd the convergence o the -values to the root o Equaton.(a). The table on the rght shows the attempts made to nd the rst two roots We wll notce rom ths table that t onl took attempts to nd the convergence to the rst root at =.. It, however, took 6 attempts to reach a convergence to the second root at =.867 wth an ntal estmate o the root at = 4. (c) Attempt Computed Notes number () +.5.8 Estmate o rst root.8.9998.9998. Converges to rst root 4 4..88 Estmate o second root 5.88.4655 6.4655.47 7.47.98 8.98.87 Begns to converge to root 9.87.868.868.867 Converges to second root 8

.. The Newton-Raphson Method-Cont d Eample. (p.44) Determne the locate the mark lne or the content volume o 5 mlllter n a measurng cup wth ts dmensons shown n the rght o Fgure.4 (p.45).: Soluton: Fgure.4 We assume the mark on the measurng cup or 5 mlllter (ml) s stuated at L as ndcated n Fgure.4. We thus need to determne the value o L, so that the volume o the measurng cup wth the content at the heght L to be 5 ml. The volume o a sold o revoluton o a gven length ma be determned b Equatons (.6) or (.7) (pp. 4-44). The prole o the measurng cup n Fgure.4 s represented b a uncton () =.6 +.75 n an - coordnate sstem shown n the rght dagram. We wll use Equaton (.7) to determne the volume o the content o the measurng cup wth a content level L b the ollowng epreesson: V L L d.6.75 d.68 L.884L 44.5L Snce the volume o the measurng cup wth the content level L s 5 ml or 5 cm, we wll have the ollowng equaton or the unknown quantt L: 5.68L.884L 44. 5L or n an alternatve orm o: L 7.L 647.9L8656.7 We recognze that Equaton (a) s a nonlnear cubc equaton, and one o the roots o ths equaton wll be the length L, whch s the soluton o ths eample. We wll use the Newton/Raphson method to solve the cubc equaton n Equaton (a). (a) 9

.. The Newton-Raphson Method-Cont d Let us substtute the unknown L n Equaton (a) wth usual unknown o nonlnear equatons b. The soluton we wll seek wll be o Equaton (b) nstead. We wll thus have the equaton: and ts dervatve: 7. 647.98656. 7 ' 4.6 647. 9 We wll estmate the root o Equaton (a) to be L = = 4. ( = ), and usng Equaton (.5) or the net estmate root to be: 4 ' 4 878.6 4 4 8.88 57.79 ' We ound the subsequent estmaton o the roots o Equaton (c) rapdl convergng to the ollowng values 56.585 8.88 8.7 and 4 8.7 8. 5.47 996.87 The last estmated root 4 = 8.5 whch s close to the soluton = 8.566 obtaned rom an onlne sotware: Wolram/Alpha Wdgets (www.wolramalpha.com/wdgets/vew.jsp?d). We ma thus conclude that the mark lne o 5 ml or the measurng cup n Fgure.4 s located at the length L = 8.5 cm rom the bottom o the cup. (b) (c)

.. The Newton-Raphson Method-Cont d Eample.4 (p.46) In Eample 8.9 n Chapter 8 (P.68), we derved the an equaton to descrbe a mass that s attached to a sprng that would break when ts elongaton reached. m durng resonant vbraton o the sprngmass sstem. We need to determne the tme t at whch the sprng breaks rom Equaton (a): Soluton: We wll use the Newton-Raphson s method to solve the unknown quantt t n Equaton (a) b rst assumng a soluton on t =.75. We made ths assumed soluton based on a crude appromated value o t =.7 n Eample 8.9. Agan, let us replace the unknown quantt t n Equaton (a) b conventonal unknown smbol n the ollowng alternatve orm:.5 cos sn. (b) wth.5 cos sn. (c) and the dervatve: '.5.5sn Thus, the estmated root + ater the prevousl estmated root ma be computed b usng the epresson n Equaton (.5), as wll be shown n the net slde. (a) (d)

.. The Newton-Raphson Method-Cont d Soluton rom the equaton:.5 cos sn. (a) We wll begn the soluton process wth an ntal estmate o the root o Equaton (b) to be =.75, whch leads to the ollowng subsequent appromate root b Equaton (.5):.75.75 ' '.75.75.5.75/ cos(.75).5.5.75sn.75. 869979 sn(.75/. / Result o the above computaton wth =.869979 s presented n Tral No. n the ollowng table. Tral No. Assgned () '() + % Derence.75 -.6576.486.869979 6.8 -.996.4675.857644 7..85 -.4.994.8646.5 4.9.8558.64847.8484-5.7 5.855 -.959.89694.8676.79885 6.857 -.84.8555.86846.56545 7.86.567.797.869.64 8.86.95.78.869 -.6 We observe that better results led n the range o: Tral Nos.. -4 and 7-8 where the % derence crossed the +ve to ve numbers n the last column n the above dagram. Rapd convergences to accurate solutons emerged wth ths method.

.4 Numercal Integraton Methods (p.47) Dente ntegraton o unctons over specc ntervals o varables that dene the unctons s a requent requrement n engneerng analss. Some o the practcal applcatons o ntegraton are presented n Secton. n Chapter.(p.8) Eact evaluaton o man dente ntegrals can be ound n handbooks [Zwllnger ] but man others wth unctons to be ntegrated are so complcated that analtcal solutons or these ntegrals are not possble. Numercal methods provde vable was or such evaluaton. In ths secton, we wll present three numercal ntegraton methods: () the trapezodal rule, () the Smpson s one-thrd rule, and () the Gaussan quadrature. The rst two methods requre gven unctons n the ntegrand o the dente ntegrals. The last method, the Gaussan quadrature wll automatcall dene optmal locatons on whch the ntegratons are perormed. It s a popular numercal ntegraton method n advanced numercal analses, such as the nte element method presented n the subsequent chapter. We wll ocus our eort on rereshng the prncples that are relevant to the development o algorthms o these partcular numercal ntegraton methods but not on ther proos.

4 We have learned rom Secton..6 (p.6) that the value o a dente ntegral o a uncton () s equal to the area under the curve produced b ths uncton between the upper and lower lmts varables o the uncton as llustrated n Fgure.6..4. The trapezodal rule or numercal ntegraton (p.48) Mathematcall, the ntegral o uncton () can be epressed as: A Area d I b a Fgure.6 The value o the ntegral o a uncton ma thus be determned b computng the area covered b the uncton between the two speced lmts. For eample, the value o the uncton () n Fgure.7 ma be appromated b the sum o the plane trapezods wth areas A, A and A, wth the values o: h A h A h A The sum o A, A and A s equal to: ) ( h h h h d A A A o (.7) n whch h s the assgned ncrement o varable, and,, and are the values o the uncton evaluated at,, and respectvel. (.6) Fgure.7

.4. The trapezodal rule or numercal ntegraton Cont d Eample.5 (p.49) Use the trapezodal rule to evaluate the ntegral d wth a =.5 and b =.5 and assgned ncrement h =. Soluton: b n whch the uncton 6 a. We wll demonstrate the use o trapezodal rule or numercal ntegraton b plottng the uncton () verses as shown n the Fgure.8: The value o the ntegral that we need to determne s: I 6 d B usng the trapezodal rule wth the three.5.5 trapezodal llustrated n Fgure.8, we ma evaluate the ntegral I b usng the epresson n Equaton (.7) as:.5 Fgure.8 h d.5 76.48 76. 5.4 8. 9 I 6 o.5 The above numercal ntegraton resulted wth I=8.9 wth ncrement h=. s actuall less than the value I=9.45 that one would obtan rom eact ntegraton o the same uncton rom an ntegraton table In a handbook. Ths dscrepanc n results should not be a surprse, as a usual rule o thumb n usng numercal appromaton method wth the accurac o the result closel related to the sze o ncrement h used n the appromatons. We wll demonstrate such rule n the ollowng descrpton. 5

.4. The trapezodal rule or numercal ntegraton wth multple varable ncrements Cont d (p.5) () The appromate value o the ntegral o uncton () n Fgure.9 s equal to the sum o all the trapezods n the gure b the ollowng equaton derved rom the same prncple as n the oregong case wth three trapezodal: I a b d A A A... A h Fgure.9 Integral o uncton () wth multple trapezods n... where h s the sze o the varable ncrement along the -coordnate n the numercal ntegraton, as shown n Fgure.9. n n (.8) 6

.4. The trapezodal rule or numercal ntegraton Cont d Eample.6 (p.5) Evaluate the same ntegral n Eample.5 but wth a reduced ncrement h =.5. The value o the ntegral that we need to determne s: I d 6 d wth the uncton 6 The area covered b the uncton between = and =.5 s appromated b what s shown n Fgure.. We wll rst determne the uncton values () at =.5,.,.5,.,.5,. and.5, as shown n the ollowng table: n n n-.5.5. 58.9.5 76.48 4. 8.8 5.5 76. 6. 55.56 7.5 5.4 I.5.5.5.5.5 Fgure. Integraton o a uncton () wth 6 trapezods Ths table also shows the uncton values,,,, 4, 5 and 6 requred n the computaton o the areas o the ve trapezods n Fgure.. We ma use Eq.(.8) to compute the sum o the areas o the ve trapezods to be:.5 58.9 76.48 8.8 76. 55.56 5.4 88. 88 We obtaned the value o 88.88 or the same ntegral I wth h =.5 s much closer to the analtcal value o 9.45 than what we obtaned wth I=8 wth h =. n Eample.5, whch demonstrates the act that the smaller ncrement h, leads to more accurate results usng numercal methods. 7

.4. Numercal Integraton b Sampson s One-Thrd Rule (p.5) We have learned that we ma evaluate an ntegral b summng the plane areas under the curve representng the uncton (the ntegrand) n the ntegral between two lmts o the varable n the ntegraton, as llustrated n Fgure.(a): We notce rom ths gure that the area under the uncton () s made up b straght edges and the arc AB (not a straght lne). We use the trapezodal method to evaluate the ntegral Fgure.(a) b appromatng the area under the uncton () between a and b b a trapezod as llustrated n Fgure.(b) wth a straght edge n dotted lne, nstead o an arc AB. Fgure. (b) One would not hestate to recognze the dscrepanc n results rom usng the trapezodal appromaton method usng trapezods, nstead o usng the arc AB or the area. The Smpson rule, n partcular, the Smpson one-thrd rule. ders rom the trapezodal method b assumng a parabolc uncton () = a + b + c connectng adjacent ponts A and B on the curve representng the uncton () as shown n Fgure.(c). Ths parabolc uncton wth constant coecents a,b and c to be determned b the Sampson one-thrd rule wll not onl result n aster convergence to results but also oers much accurate results n numercal ntegratons. Fgure. (c) 8

.4. Numercal Integraton usng Sampson s One-Thrd Rule Cont d Math ormulaton o Sampson One-thrd Rule or numercal ntegraton (p.5): I Fgure.(c) AREA B reerrng to the dagram n Fgure.(c), n whch the uncton n the ntegrand s: () = a + b + c, we wll have the uncton evaluated at three ponts at = -, = and =+: = a(-) + b(-) + c = c and = a() + b() + c rom whch we ma solve or: a (.9a) c = (.9b) The value o the ntegral o the uncton () s equal to the plane area A n Fgure.(c), or AB d a b c a 6c d a b c B substtutng the constant coecents a and c n Equaton (.9a, b), together wth = n Fgure.(c) nto the above epresson, we wll get the ollowng relaton or the Smpson one-thrd rule or the ntegral I: I d a b cd 4 (.) 9

.4. Numercal Integraton b Sampson s One-Thrd Rule Cont d Eample.7 (p.5) Use Smpson one-thrd rule to nd the numercal value o the ntegral n Eample.5: I= Soluton: 6 b. a d n whch We wll use the three uncton values at =.5,. and.5 to compute the value o the ntegral. In such case, the ncrement o the ntegraton varable s =.5. The ntegral s determned b the epresson n Equaton (.). We ma obtan the uncton values, and at =.5, and.5 rom the Table n Eample.6 as: =.5, = 8.8 and = 5.4. Integraton o the uncton () n ths eample5 can thus be determned b substtutng the values o, and and the ncrement o, =.5 nto Equaton (.) to gve: I d a b cd 4.5.5.5.5 d 6 d.548.85.4 94. 7.5 The eact soluton o the above ntegral s 9.45 rom a math handbook, rom whch we ma have the ollowng comparson o results between the I = 88.88 b three trapezodal n Eample.5 and the current soluton I = 94.7 wth three uncton values usng the Smpson one-thrd rule.

.4. Numercal Integraton b Sampson s One-Thrd Rule Cont d (use mult-values o the uncton n ntegrand) (p.54) One ma use Equaton (.) to evaluate ntegrals nvolvng more than three uncton values between two speced lmts or the ntegraton. We wll use the same llustraton n Fgure. to derve the general epresson or the Smpson one-thrd rule or numercal ntegraton. From whch, we ma thus epress the general epresson o Smpson one-thrd rule n the ollowng equaton: I h d 4 4... b 4 n 4 n a Fgure. n (.)

.4. Numercal Integraton b Sampson s One-Thrd Rule Cont d Eample.8 (p.55) Use the Smpson one-thrd rule n Equaton (.) to evaluate the ntegral n Eample.6: Soluton: I.5.5.5 d 6 d.5 Because the uncton () n the ntegral that we need to evaluate s same as we had n Eample.6, so we wll use the same table or the values o the present uncton wth =.4 or the Sampson method. The eght uncton values are presented n the ollowng Table wth these data ponts shown n Fgure.4. n 4 5 6 7 8 n.5.9.6.79..64.7.5 = ( n ).5 54.69 7. 8.89 8.85 7.54 5.68 5.4 Fgure.4 We can thus use Equaton (.) and evaluate the ntegral I to be: I.5.5.4.5 d 6 d 4 4 4 45 6 7.5.5 454.69 7. 48.89 8.85 47.54 5.68 5.4 86. 45

.4. Numercal Integraton b Gaussan Quadrature (p.56) Most numercal methods or evaluatng dente ntegrals requre the users to select the samplng ponts and evaluate the ntegral n terms o the dscrete values o the uncton at these ponts. These methods usuall work well wth well-behaved unctons n the ntegral, but the do not oer an gudelne on the selecton o the sze o the ncrement (h or ), n numercal computatons, as n the prevous ormulatons. There are tmes when engneers are epected to nd numercal values o ntegrals nvolvng unctons that have drastc change o shapes over the range o the requred ntegratons. These methods do not eld good appromaton o the numercal values o the ntegral because o mproper selecton o samplng ponts. Gaussan quadrature method has the advantage o oerng the users wth crtera on optmal samplng ponts n numercal ntegraton. It was establshed on the bass o strategcall selected samplng ponts. The normal orm o a Gaussan ntegral can be epressed as: n I F d H F a (.) where n s the total number o samplng ponts, H are the weghtng coecents correspondng to samplng ponts located at : a as gven n Table. on P. 57. The orm o Gaussan ntegral shown n Equaton (.) s rarel seen n practce. A transormaton o coordnate s requred to convert the general orm o ntegraton such as shown n Equaton (.6) on p.48 to the orm shown n Equaton (.), as llustrated n Fgure.5. (a) (b) Fgure.5 Transorm o coordnates

4.4. Numercal Integraton b Gaussan Quadrature Cont d on ormulaton (p.56) The transormaton o coordnates rom () n the -coordnate to the uncton F(ξ) n the coordnate ξ ma be accomplshed b usng the ollowng relatonshp: a b a b (.) whch leads to the ollowng epresson: d F d a b b a (.4) where a b b F and d d a b We wll obtan the epresson or the requred evaluaton o the ntegral n Equaton (.6) usng Gaussan quadrature b substtutng the relatonshp n Equaton (.) nto the above epresson n Equaton (.4) n the ollowng orm: n a b a F H d I b a (.5)

.4. Numercal Integraton b Gaussan Quadrature Cont d Eample.9 (p.58) Evaluate the ollowng ntegral b usng the Gaussan quadrature n Equaton (.4). Soluton: I cos d We have the uncton () = cos over the ntegraton lmts a = and b = π. The transormaton o coordnates makes use o the relatonshp rom Equaton (.), rom whch we get: cos F cos sn Also, rom Equaton (.4) wth the use o the trgonometrc relatonshps such as: sn cos and cos sn We ma arrve at the ollowng epresson or ntegratng I n Equaton (a) usng Gaussan quadrature: I cos d sn d sn d n H sn a Let us take, or eample, samplng ponts,.e., n = rom Table. on P.57 wth: a = a = +.77459 a = -.77459 (a) (b) H =.88888 H =.55555 H =.55555 Substtutng the above numbers nto Equaton (b) wll lead to the soluton: I.88888 sn.55555 sn.77459.55555 sn.77459.5555 5 sn.67.55555 sn.67 5

.4. Numercal Integraton b Gaussan Quadrature Cont d Eample. (p.6) Evaluate the ollowng ntegral n Eample.8 usng Gaussan quadrature method Soluton: I.5.5.5 d 6 d We notce the uncton () n the ntegral n Equaton (a) s dentcal to what we had n prevous Eamples.5 (p.49), 6 (p.5) and 8 (p.55). We wll rst derve the epresson o the uncton F(ξ) or the uncton () n Equaton (a) rom the ntegraton lmts o.5 and.5 to the lmt - and +, as requred n Gaussan quadrature. The transormaton o coordnate sstems as llustrated n Fgure.5 begns wth the transormaton o varable rom to ξ usng the relatonshp n Equaton (.), leadng to the ollowng relatonshp between the varables and ξ as shown below: b a b a.5 (c).5 (a) The ntegral n Equaton (a) n the () vs. coordnates can thus be transormed to the F(ξ) vs. ξ coordnates b usng Equaton (.4), eldng the ollowng epresson:.5.5 b a I d d F d.5 6.5.5.5 d.5 We ma thus evaluate the ntegral wth the epresson n Equaton (d) as: I.5 d.5.5.5 6 d.5 6.5 (d) 6

.4. Numercal Integraton b Gaussan Quadrature Cont d on soluton o Eample. We have arrved at the ollowng ntegral: I.5 d.5.5.5 6 d.5 6.5 rom whch we have the uncton n the orm o Gaussan quadrature:.5.5 6 F We ma thus use Equaton (.) or the value o the ntegral I n Equaton (a) to be: n I.5 H F a Let us choose samplng ponts or the ntegral n Equaton (),.e., n= n Equaton (e) wth a and H ( =,, ) rom Table., as tabulated below: a H.88888.77459.55555 -.77459.55555 B substtutng the above numbers nto Equaton (), we wll have the value o the ntegral I as: (e) () I =.5 [H F() + H F(.7746) + H F(-.7746)] We ma evaluate the uncton values at a usng Equaton (e) as: F() = 8.84, F(.77459) = 46.498, and F(-.77459) = 5.454 (.6) Substtutng these uncton values nto Equaton (e) wll result the ntegral I n Equaton (a) as: I.5.5.5 d 6.5 d.88888.84.555546.498.55555.454 9. 684.5 Ths value o the ntegral n Equaton (a) obtaned b Gaussan quadrature wth three samplng ponts s remarkabl close to the eact value o 9.45 obtaned rom a math handbook. (g) 7

.5 Numercal Methods or Solvng Derental Equatons (p.6) Numercal soluton methods or derental equatons relatng to two tpes o engneerng analss problems: () The ntal value problems, and () the boundar value problems. Numercal soluton methods wll oer the users wth soluton o the derental equatons at soluton ponts, but not everwhere wthn the varable domans. Soluton o ntal value problems nvolves a startng pont wth the varable o the uncton, sa at, whch s a specc value o varable or soluton (). Wth the soluton gven at ths startng pont, one ma nd the solutons at = o +h, o +h, o +h,., o +nh, n whch h s the selected step sze n the numercal computatons and n s an nteger number o steps used n the analss. Numercal soluton to boundar value problems s more complcated, n whch uncton values are oten speced at certan varables, and there are restrctons on how the selected steps or soluton values ma be restrcted b the speced values at these varable ponts. The number o steps n n the computaton can be as large as what takes to cover the entre range o the varable n the analss, or as small as selected b the users. Lke all numercal soluton methods, smaller soluton steps would oer more accurate results as n general cases. There are man numercal soluton methods avalable or engneers to solve derental equatons. We wll present: () The nte derence method to llustrate the prncples o convertng derental equatons to derence equatons, and () the Runge-Kutta method - a popular method b engneers.. 8

.5. The prncple o nte derence method (p.6) The essence o the nte derence method (FDM) s to convert the dervatves n the derental equatons nto derence, so that derental equaton ma be epressed n algebrac equatons n terms o the converted ormat o derences. Wth regard to Fgure.6, we have a contnuous uncton () that has values -, and + at the varables -, and + respectvel. We ma also desgnate the three uncton values at the three -values to be: = () + = ( + Δ), and (.6a) (.6b) - = ( Δ) (.6c) The dervatve o the uncton () at Pont A wth = n Fgure.6 s graphcall represented b the tangent lne A -A Fgure.6 Functon Evaluated at postons to the curve representng uncton () at pont A. Mathematcall, we ma epress the dervatve as gven n Equaton (.9) on p.4, or n the orm: d ( ) d m (.7) o where s the ncrement o varable used n the above dervatve. One ma observe an mportant relaton rom Equaton (.7) that the dervatve ma be appromated b the nte ncrements o correspondng to as ndcated n Equaton (.8). d ( ) (.8) d We thus realze that dervatves o contnuous unctons ma be appromated b adoptng nte, but not the nntesmall small ncrements o varable. Formulaton wth such appromaton s called nte derence. 9

.5. The Basc Fnte-Derence Schemes (p.6) ) The orward derence scheme: In ths orward derence scheme, the rate o change o the uncton () wth respect to the varable s accounted or between the uncton value at the current value at = and the value o the same uncton at the net step,.e. + = + n the trangle A Aa n Fgure.6. The mathematcal epresson o ths scheme s shown n Equaton (.9). h d d ) ( (.9) Fgure.6 Functon Evaluated at postons n whch h = s the step sze. The dervatve o the uncton () at other values o the varable n the postve drecton can be epressed ollowng Equaton (.9) to be:., etc h h (.) The second order dervatve o the uncton () at can be derved b the ollowng procedure: ) ( h h h h h m d d d d (.)

.5. The Basc Fnte-Derence Schemes Cont d ) The backward derence scheme: Fgure.6 Functon Evaluated at postons In ths derence scheme, the rate o the change o the uncton wth respect to the varable s accounted or between the current value at = and the step backward,.e. - = - n the trangle AA a n Fgure.6. The mathematcal epresson o ths scheme s gven n Equaton (.): h m m ) ( ) ( (.) Followng a smlar procedure n the orward derence scheme, we ma epress the second order dervatve n the ollowng orm: h (.) ) The Central derence scheme: The rate o change o uncton () n ths nte derence scheme accounts the uncton values between the prevous step at (- ) and the step ahead,.e. (+ ). The trangle nvolved n ths derence scheme s A A a n Fgure.6. We have the rst order dervatve epressed n Equaton (.4). h (.4) Equaton (.4) nvolves a larger step o the sze h n the rst order dervatve. These coarse steps wll compromse the accurac o the values o the dervatves. A better central derence scheme s to account or the hal steps n both drectons. We ma mprove the step sze n Eq.(.5): and (.5) leadng to: h (.6)

.5. The Basc Fnte-Derence Schemes Cont d Eample. (p.64) Solve the ollowng derental equaton usng the orward nte derence scheme. wth speced ntal condtons: Soluton: ( ) ( ) d ( t) d t ( t) Let us use the orward derence scheme ollowng Equatons (.9) and (.) wth the nte derence scheme: d( t) ( t t) ( t) (d) dt t ( t) ( t t) ( t t) ( t) and d ( t) d t Substtutng Equaton (e) nto Equaton (a) results n the ollowng nte derence orm o the derental equaton: ( t t) ( t t) ( t) ( t) ( t) Upon re-arrangng the terms n the above equaton, we get the ollowng recurrence relaton or the appromate soluton o Equaton (a): () wth and () = (t) = () = ( t t) ( t t) [ ( t) ] ( t) (a) (b) (c) (e) (g) (h)

.5. The Basc Fnte-Derence Schemes Cont d Eample. Cont d The nte derence equaton: wth and () = (t) = () = ( t t) ( t t) [ ( t) ] ( t) () (g) (h) We are now read to solve or (t) n Equaton (a) usng the nte derence operator b repeated use o the recurrence relaton n Equaton (). The soluton o (t) wll be on the ncremental steps o t chosen b the user. B reerrng to the ntal condtons n Equatons (g) and (h) we ma get the (t) at all subsequent steps Choce o soluton steps, t: Let us assume that a step sze t =.5 s chosen or the soluton. The correspondng soluton becomes, rom Equaton () wth t =.5: (t+.) (t+.5) +.5(t) = and rom Equaton (h): (.5) = (j) (.) (.5) +.5() = Because () s the ntal condton n Equaton (g), so the above relaton elds (+.) (+.5) = -.5 But snce (.5) = rom Equaton (h), we have: (.) = -.5 + (.5) =.9975 (k)

.5. The Basc Fnte-Derence Schemes Cont d Eample. Cont d The nte derence equaton: wth and () = (t) = () = ( t t) ( t t) [ ( t) ] ( t) () (g) (h) We ma now move to the net tme pont b lettng t = t + t = +.5 =.5 and havng t =.5 substtuted nto Equaton () and get: (.5+.) (.5 +.5) +.5(.5) =, or (.5)- (.) +.5(.5) = (m) Snce we have alread obtaned (.) =.9975 rom Equaton (k) and (.5) = rom Equaton (h), we wll thus have another soluton pont rom Equaton (m): (.5) =.9975.5 =.995 (p) We wll move to the net tme pont that s t = t + t =.5 +.5 =.. Substtutng t=. onto Equaton (), we get: (. +.) (. +.5) +.5(.) = But wth (.5) =.995 rom the last step n Equaton (p) and (.) =.9975 rom Equaton (k), we wll have: (.) (.5) +.5(.) = or (.) =.995.5.9975 =.985 (q) 4

.5. The Basc Fnte-Derence Schemes Cont d Eample. Cont d Thus, b ollowng the same procedure as llustrated above, we ma obtan soluton o Equaton (a) at all tme ponts wth an ncrement t =.5. wth gven condtons: ( ) ( ) d ( t) d t ( t) (a) (b) (c) The results obtaned rom the orward derence scheme are summarzed n the Table below, wth the comparson to the eact soluton o (t) = cost: Varable, t Soluton b the nte derence method Eact soluton % Error.5.999996..9975.9954.5.5.995.98877.8..985.9866.5 One wll observe rom the above-tabulated values that the percentage o error o the results obtaned rom the nte derence method ncreases wth the ncrease o varable t, and prove that the accurac o the nte derence method mproves wth smaller ncrements o the varables, e.g. the t n the present eample 5

.5.4 A Popular Numercal Soluton Method o Solvng Derental Equatons -The Runge-Kutta Methods (p.67) There are a number o numercal soluton methods avalable or solvng derental equatons relatng to both tpes o ntal value and boundar value problems. Readers can nd detaled descrpton o these methods rom specal books on ths subject rom the reerences cted n ths book. What we wll present n ths Secton are the two popular numercal soluton methods on both the nd-order and the 4 th -order Runge-Kutta methods. Both these Runge-Kutta methods are ntegratve methods or appromaton o solutons o derental equatons. Ths method wth several versons were developed around 9s b German mathematcans C. Runge and M.W. Kutta. The essence o the Runge-Katta methods nvolves the use o numercal ntegratng the uncton n derental equatons b usng a tral step at md-pont o an nterval, e.g., wthn a step or h b usng numercal ntegraton technques such as trapezodal or Smpson rules as presented n Secton.4. The numercal ntegratons would allow the cancellaton o low-order error terms or more accurate solutons. As n the precedng sectons on numercal methods or engneerng analss, we wll present the ormulatons o the Runge-Kutta methods n ths secton wthout proo these ormulatons mathematcall. We wll also use commercall avalable sotware b the name o MatLAB to sole a selected derental equaton wth plot o ts soluton n Case n Append 4 on page 478. 6

.5.4. The Second-order Runge-Kutta Method (p.67) Ths s the smplest orm o the Runge-Katta method wth the ormulatons or the soluton o rst order derental equaton n the ollowng orm: () = (,) (.) wth a speced soluton pont correspondng to one specc condton or the Equaton (.). The soluton ponts o ths derental equaton can be epressed as: k O h where O(h ) s the order o error o the step h, and where Eample. (p.68) k (.) h h, k k h, (.a) (.b) Use the second order Runge-Kutta method shown n Equatons (.) and (. a,b) to solve the ollowng rst order ordnar derental equaton smlar to that n Eample 7.4 on p.: d (a) d wth a gven condton () =. We wll solve Equaton (a) wth condton () = n Eample 7.4 wth an eact soluton o () = + e -. 7

.5.4. The Second-order Runge-Kutta Method cont d Eample. Cont d Use the second order Runge-Kutta method shown n Equatons (.) and (. a,b) to solve the ollowng rst order ordnar derental equaton smlar to that n Eample 7.4: d (a) d wth a gven condton () =. Soluton: Let us rst re-arrange Equaton (a) n the ollowng orm: d d, ' rom whch we have:(,) = (b) and the speced soluton pont: () = = We are now read to determne the rst soluton pont usng Equaton (.) to (.a,b): Step : Wth = and selected ncrement h =.: k.. k. k h., k.. We thus have our rst soluton pont:.8 = + k =.8 =.8 (the eact soluton s: =.887) 8

.5.4. The Second-order Runge-Kutta Method cont d Eample. Cont d Use the second order Runge-Kutta method shown n Equatons (.) and (. a,b) to solve the ollowng rst order ordnar derental equaton smlar to that n Eample 7.4: d (a) d wth a gven condton () =. We ma move the soluton pont orward to: =, h =. wth =.8: We should have the soluton pont: = + k as n Equaton (.), wth: k k...8. 64 h, h h, k..8.64 Hence the second soluton pont, s:.84 = +k =.8.84 =.696 (eact soluton s: =.67) We observe that the error o numercal soluton accumulates rom.7% or to.8% or. 9

.5.4. The 4 th Order Runge-Kutta Method (p.69) Ths s the most popular verson o the Runge-Kutta method or solvng derental equaton o ntal value problems. Formulaton o ths order soluton method s smlar to that o the second order method. The derental equaton s smlar to that shown n Equaton (.) wth : () = (,) but wth the soluton pont gven b the ollowng ormula: h k k k k4 (.) 6 where k, (.4a) k k h kh, h kh, k4 h, k Eample.4 (p.69) h (.4b) (.4c) (.4d) Use the Runge-Kutta 4 th order method to solve the same derental equaton n Eample. but onl or the second soluton pont. Soluton: d The derental equaton we wll solve s: wth gven condton o () =. d Eample. alread solve the rst soluton pont wth =.8 wth a chosen step sze o h =.. We are requred to nd the net soluton pont at wth = usng the same step sze o h =.. 4

.5.4. The 4 th Order Runge-Kutta Method-Cont d Eample.4 cont d d We need to translate the derental eqaton d nto the orm o the derental equaton usng the Runge-Kutta soluton method n the orm o () = (,) as shown n Equaton (.) wth: (,) = - (a) and = Eample. alread solve the rst soluton pont wth =.8 wth a chosen step sze o h =.. We are requred to nd the net soluton pont at wth = usng the same step sze o h =.. We ma use the epresson n Equaton (.) to obtan soluton pont or the derental equaton n Eample. to be:. k k k k4 (b) 6 where k, k, k and k 4 can be obtaned b usng the epressons n Equatons (.4a, b, c and d) respectvel: (c) k,.8. 64 (d) Substtutng the constants k, k, k and k 4 n Equatons (c,d,e,) nto Equaton (b), resultng n: (e) () We nd the above soluton usng the 4 th order Runge-Katta method s remarkabl close to the eact soluton o =.67. Ths s a much more accurate result than what can be obtaned b usng the nd order Runge-Kutta method as llustrated n Eample.. 4

.5.4. Runge-Kutta Method or Hgher Order Derental Equatons (p.7) We have learned that Runge-Kutta method can solve derental equatons oten wth remarkable accurac as demonstrated n Eample.4. Unortunatel most tetbooks onl oer the applcaton o ths valuable method or solvng rst order derental equatons. Its applcaton to solve hgher order derental equatons requres the converson o hgher order derental equatons to the rst order-equvalent orms such as n Equaton (.) on p. 67. The soluton o the converted hgher order derental equatons can be obtaned b usng the epressons such as gven n Equaton (.) or the 4 th order Runge-Kutta ormulaton. We wll present the ollowng ormulaton to llustrate how the ourth order Runge-Kutta method can be used to solve second order ordnar derental equatons We wll rst epress the gven second order ordnar derental equaton n the orm: d d,,,, ' (.5) d d d' Snce the let-hand-sde o Equaton (.5) ma be epressed as:, we ma convert the d second order derental equaton n (.5) nto a rst order derental equaton n the orm: d',, ' (.6a) d d wth ' F,, ' (.6b) d 4

.5.4. Runge-Kutta Method or Hgher Order Derental Equatons Cont d We wll present the converted nd order derental n Equaton (.5) n Equatons (.6a) and (.6b) below: d',, ' (.6a) d d wth ' F,, ' (.6b) d Soluton ponts + o these second order derental equatons ma be obtaned b the ollowng epressons derved rom the 4 th order Runge-Kutta method: F F F F4 h (.7) 6 ' and ts dervatve: 4 h (.8) 6 where h = the ncrement o the soluton ponts n the -coordnate. The coecents F, F, F and F 4, and,, and 4 n Equatons (.7) and (.8) can be obtaned b the epressons gven n the ollowng table (Table.4) on p.7: ',, 4

.5.4. Runge-Kutta Method or Hgher Order Derental Equatons Cont d Eample.5 (p.7) Use the 4 th order Runge-Kutta method to solve the ollowng second order derental equaton wth gven condtons: d d ' ' d d d d 4 Soluton: B comparng Equaton (a) wth Equaton (.5), we wll obtan the ollowng epresson or the uncton (,, ) n Equaton (.5): (c) (,, ) = ( - 4 + ) + wth the speced condtons o = and () = or our subsequent numercal soluton o the derental equaton. We wll select derent step szes: h =.,.6 and. or the three case llustratons usng b ollowng a procedure, startng wth varable at =. (a) (b) (b) 44

45 We begn the numercal soluton or Equaton (a) b lettng = n Equaton (.7) wth = = =, and (,, )=( -4+)-+ or the rst soluton pont at = h =.:.5.4. Runge-Kutta Method or Hgher Order Derental Equatons Cont d Eample.5 - Cont d We wll obtan the ollowng coecents b usng the epressons or the coecents gven n Table.4: ) ( ' condton gven a F 4, ' ', o.. ' h F... ' h F

.5.4. Runge-Kutta Method or Hgher Order Derental Equatons Cont d Eample.5 - Cont d We begn the numercal soluton or Equaton (a) b lettng = n Equaton (.7) wth = = =, and (,, )=( -4+)-+ or the rst soluton pont at = h =.: We are read to nd the numercal soluton o the derental equaton n Equaton (a) b substtutng the values o F, F, F and F 4 nto Equaton (.7), and obtan a soluton pont wth = and h =.: The eact soluton o Equaton s () =, whch elds an eact soluton o (.) =.4. The numercal soluton n Equaton (d) has a.4% error rom the eact soluton. We wll also use Equaton (.8) to appromate the value o the rst order dervaton (.) as: (d) 46

.5.4. Runge-Kutta Method or Hgher Order Derental Equatons Cont d Eample.5 - Cont d We have thus obtaned the numercal soluton or Equaton (a) as computed n the prevous slde, n whch we let = n Equaton (.7) wth = = =, and (,, )=( -4+)-+ or the rst soluton pont at = h =.. One ma ollow the same procedure to obtan the soluton o Equaton (a) at pont: = + h wth h =.,.4,.6 and. to see the derence n the solutons, and also the % o errors n these solutons wth derent h-values. Table.5 shows these solutons and the % errors n the solutons usng derent h-values. Lke all other numercal soluton methods or solvng derental equatons, the accurac, or error o the appromated solutons depends largel on the step sze h chosen b the users. We have demonstrated the eects o the chosen ncrement sze h or the same derental equaton n Equaton (a) but wth other two h-values wth h =.6 and. n two separate cases. The results o these two cases, together wth the cases o h =.,. and.4 are summarzed n the same Table.5. Table.5 Enhanced Solutons o a Derental Equaton b Runge-Kutta Method wth 5 ncremental szes Case Number:, 4 5 X h...4.6. F F...4.6. F..5.48.67.46 F 4.984.99957.794.784.4864..5.4.9.6.99.99775.976.964.7 4.878.99957.9446.946.96 ().97.5.79844.486.56 Appro..4..64.64.546 ( o +h) Eact ( o +h).4..6.6.44 %Error: (h)..4.667.9 7. %Error: (h).5..95 NOTE: Case runs wth solutons b MatLAB n Case n Append 4 o the book (p. 478). Cases presented n Table.5 on p.7 47

.5.4. Runge-Kutta Method or Hgher Order Derental Equatons Cont d Solvng a Hgher Order Derental Equaton usng Runge-Kutta method and onlne MatLAB sotware The soluton wth ncremental sze such as h=. obtaned b manual operatons usng Runge- Kutta method n Eample.5 appeared tedous and tme-consumng. The same derental equaton wth peced condtons was solved b a commercal sotware package MatLAB wth the nput/output normaton ncluded n Case o Append 4 (P.478). The results obtaned b usng ths sotware were remarkabl accurate wth soluton at the same three ponts,.e.: at =., =.6 and = =. wth h=. are plotted n the graphc output as shown n Fgure.7 b the MatLAB sotware wth I/O ndcated n Case o Append 4 (p. 48). Fgure.7 Graphc Output o the Soluton o a nd Order Derental Equaton Usng MatLAB Sotware Package 48

.5.4. Runge-Kutta Method or Hgher Order Derental Equatons Cont d Eample.6 (p.7) Use the 4 th order Runge-Kutta method to solve the last soluton o the uncton (t) at t =. n the second order derental equaton n Eample. (p.64), n whch the same nd order derental equaton was solved b usng a orward derence scheme. Ths eample demonstrates the act that Runge-Kutta method can be related to the nte derence method o solvng derental equatons. Soluton: The derental equaton to be solved s: wth speced condtons: d ( t) dt t (a) () = and Snce we do not have the term ' ( t) n Equaton (a), we wll not need to evaluate F, F, F and F 4 n Table.5. We wll use the same step sze h =.5 as was n Eample.. B ollowng the procedures adopted n the Eample.5, we epress Equaton (a) n the ollowng orm: where d dt t ' t ' and =.995 (the soluton obtaned n Eample (.) and. 4944 49

.5.4. Runge-Kutta Method or Hgher Order Derental Equatons Cont d Eample.6 (p.7)-cont d We wll use the 4 th order Runge-Katta method as shown n Equatons (.) and (.8) and the coecents gven n Table.4 (p.7) to obtan the soluton at (.) as ollows. Let =, h=.5, =.995 and = -.4944 or the soluton at t =., or ' (.) h h 6 We wll evaluate the coecents,, and 4 rom Table.4 as ollows: ' t,. 4944,, '.4944.5 h.4944 ' h ' h.576.576.5.4944.5694.4944.5694.5.5747 4 Accordng to Equaton (.8), we have the soluton '. h h 6.995.4944.5.4944.576.5694 6.5. 9848 Ths numercal soluton has an error o.48% rom the eact soluton, and t s more accurate than that obtaned rom the smple orward derence scheme n Eample.. (b) 5

.6 Introducton to Commercal Sotware Packages or Numercal Analss (p.75) We have demonstrated n ths chapter that accurate solutons o almost all numercal soluton methods requre small ncrement step szes the varable o the uncton or solutons. Smaller ncrements means more computatonal eorts and advanced dgtal computers oten are the necessar tools to acheve accurate solutons.. Consequentl, sophstcated computer packages such as the two popular commercall avalable packages wth trade names o Mathematca and MatLAB have proven to be valuable tools or engneers n ther engneerng analses. In ths secton, we wll brel hghlght these two numercal analss packages, n partcular, ther capabltes n solvng varous engneerng problems. Readers are reerred to several ecellent reerences cted n the book or more detaled descrptons o these packages, as well as eectve use o a well documented commercal sotware package named MatLAB n Append 4 o the book. 5

.6. Introducton to Mathematca (p.75) Mathematca s a computatonal sotware program based on smbolc mathematcs. It s used n man scentc, engneerng, mathematcal and computng elds. The programmng languages used n Mathematca s the Wolram Language b Stephen Wolram and C, C++ and Java. Ths sotware package has been n the marketplace snce June 988. Followng are notceable capabltes or handlng engneerng analss: ) Determne roots o polnomal equatons o cubc or hgher orders. ) Integrate and derentate complcated epressons. ) Solve lnear and nonlnear derental equatons 4) Elementar and specal mathematcal uncton lbrares 5) Matr and data manpulaton tools 6) Numerc and smbolc tools or dscrete and contnuous calculus It can also solve the ollowng common analtcal engneerng problems nvolvng: ) The determnaton o Laplace and Fourer transorms o unctons. ) Generatng graphcs n two- and three-dmensons. ) Wth smpl trgonometrc and algebrac epressons. 5

.6. Introducton to Mathematca (p.75)-cont d Mathematca also has the ollowng eatures that are o great values n advanced engneerng analses: Support or comple numbers, arbtrar precson, nterval arthmetc and smbolc computaton Solvers or sstems o equatons, Dophantne equatons, ODEs, PDEs, etc. Multvarate statstcs lbrares ncludng ttng, hpothess testng, and probablt and epectaton calculatons on over 4 dstrbutons. Calculatons and smulatons on random processes and queues Computatonal geometr n D, D and hgher dmensons Fnte element analss ncludng D and D adaptve mesh generaton Constraned and unconstraned local and global optmzaton Toolkt or addng user nteraces to calculatons and applcatons Tools or D and D mage processng and morphologcal processng, ncludng mage recognton Tools or vsualzng and analzng drected and undrected graphs Tools or combnatorcs problems Data mnng tools such as cluster analss, sequence algnment and pattern matchng 5

.6. Introducton to Mathematca (p.75)-cont d Group theor and smbolc tensor unctons Lbrares or sgnal processng ncludng wavelet analss on sounds, mages and data Lnear and non-lnear control sstems lbrares Contnuous and dscrete ntegral transorms Import and eport lters or data, mages, vdeo, sound,cad, GIS, ] document and bomedcal ormats Database collecton or mathematcal, scentc, and soco-economc normaton and access to Wolram alpha data and computatons Techncal word processng ncludng ormula edtng and automated report generatng Tools or connectng to DLL, SOL, Java, NET, C++, Fortran, CUDA, OpenCL and http based sstems Tools or parallel programmng Mathematca language n notebook when connected to the Internet The last o the above temzed eatures s o partcular value to engneers. For eample, we were requred to nd the root o the ollowng cubcal equaton n Eample.: L 7.L 647.9L8656.7 A meanngul root o ths equaton ound b usng the Newton/Raphson method was L = 8.5 as shown n Eample.. A smlar soluton o L = 8.566 were obtaned b the soluton method oered at an Internet at the webste Wolram/Alpha Wdgets (www.wolramalpha.com/wdgets/vew.jsp?d) wth user s nput o the coecents o ths equaton. It oered an nstant soluton and wth an ecellent user nterace eature. 54

.6. Introducton to MatLAB (p.76) MATLAB s an acronm o matr laborator. Ths numercal analss package was desgned b Cleve Molar n the late 97s wth an ntal release to the publc n 984. The latest verson, Verson 8.6 was released n September 5. MATLAB provdes a mult-paradgm numercal omputng envronment and 4 th generaton programmng language, a propretar programmng language developed b MathWorks. It allows matr manpulatons, plottng o unctons and data, mplementaton o algorthms, creaton o user nteraces that nclude nteracng wth programs wrtten n other languages, ncludng,c++, Java, Fortran and Pthon. It s a popular numercal analss package manl because o t has graphc and graphcal user nteracng programmng capablt. Lke Mathematca, MATLAB s capable o handlng the ollowng common problems n engneerng analss [Malek- Madan 998]: ) Fnd roots o polnomals, sum seres, and determne lmts o sequences, ) Smbolcall ntegrate and derentate complcated epressons, ) Plot graphcs n two and three dmensons, 4) Smpl trgonometrc and algebrac epressons, 5) Solve lnear and nonlnear derental equatons, and 6) Determne the Laplace transorm o unctons, 7) Plus a varet o other mathematcal operatons. Operaton o MatLAB requres user to nput smple program or the soluton o the problems. These program usuall conssts o three commands: ) the command wndow or the user to enter commands and data, ) the graphcs wndow to dspla the results n plots and graphs, and ) the edt wndow, to create and edt the M-les, whch provde alternatve was o perormng operatons that could epand MATLAB s problem-solvng capabltes Detaled nstructons on usng MATLAB or solvng a varet o mathematcal problems are avalable n MATLAB Prmer publshed b the Mathworks, Inc.(www.mathworks.com) and two ecellent reerences [Malek-Madan 998, Chapra ]. 55