Unformatted text preview: CHAPTER 1 Numerical Methods for Ordinary Differential Equations
In this chapter we discuss numerical method for ODE . We will discuss the two basic methods, Euler's Method and Runge-Kutta Method. 1. Numerical Algorithm and Programming in Mathcad 1.1. Numerical Algorithm. If you look at dictionary, you will the following definition for algorithm, 1. a set of rules for solving a problem in a finite number of steps; 2. a sequence of steps designed for programming a computer to solve a specific problem. A numerical algorithm is a set of rules for solving a problem in finite number of steps that can be easily implemented in computer using any programming language. The following is an algorithm for compute the root of f (x) = 0, Input f , a, N and tol . Output: the approximate solution to f (x) = 0 with initial guess a or failure message. Step One: Set x = a Step Two: For i=0 to N do Step Three - Four f Step Three: Compute x = x - f (x) (x) Step Four: If f (x) tol return x Step Five return "failure". In analogy, a numerical algorithm is like a cook recipe that specify the input -- cooking material, the output--the cooking product, and steps of carrying computation -- cooking steps. In an algorithm, you will see loops (for, while), decision making statements(if, then, else(otherwise)) and return statements. for loop: Typically used when specific number of steps need to be carried out. You can break a for loop with return or break statement.
View Full Document