Numeric Chap One
Numeric Chap One
– Introduction
– Mathematical Modeling
– Conservation Laws
– Numerical Errors
• Error Definitions
• Truncation Errors and Taylor Series
• Round-off Errors
• Total Numerical Error
– Worksheet 1
1
Introduction
• What are numerical methods and why study them?
• Numerical methods are techniques by which
mathematical problems are formulated so that they can
be solved with arithmetic and logical operations.
• Because digital computers excel at performing such
operations, numerical methods are sometimes referred
to as computer mathematics.
• Reasons why you should study numerical methods:
– They expand the types of problems you can address:
large systems of equations, nonlinearities, and
complicated geometries that are often impossible to
solve analytically with standard calculus.
2
Introduction
• Reasons why you should study numerical methods: …
– NMs allow you to use software and understand of
the basic theory underlying the methods.
– Because NMs are expressly designed for computer
implementation, they are ideal for illustrating the
computer's powers and limitations.
– NMs reduce higher mathematics to basic arithmetic
operations and get at the "nuts and bolts" of some
otherwise obscure topics.
3
Mathematical Modeling
• A mathematical model: “a formulation or equation
that expresses the essential features of a physical
system or process in mathematical terms”.
• In a very general sense, mathematical model can be
represented as a functional relationship of the form:
DV = f (IVs, Ps, Fs) … (1.1)
– DV = Dependent Variable
– IV = Independent Variable
– P = Parameters
– F = Forcing Functions
4
Mathematical Modeling
• where,
– Dependent Variable is a characteristic that usually
reflects the behavior or state of the system;
– Independent Variables are usually dimensions such
as time and space, along which the system's
behavior is being determined;
– Parameters are reflective of the system's properties
or composition;
– Forcing functions are external influences acting
upon it.
5
Mathematical Modeling
• Newton formulated his 2nd law of motion, which states
that “the time rate of change of momentum of a body is
equal to the resultant force acting on it”.
• The mathematical model of the 2nd law is:
F = ma ……………… (1.2)
• Eq. (1.2) can be recast in the format of Eq. (1.1) by
merely dividing both sides by m:
a = F/m ………..……. (1.3)
– a is the dependent variable reflecting the system's
behavior, F is the forcing function, and m is a parameter.
– there is no independent variable because we are not yet
predicting how acceleration varies in time or space. 6
Mathematical Modeling
• Equation (1.3) has a number of characteristics that are
typical of mathematical models of the physical world.
• It describes a natural process in mathematical terms.
• It represents an idealization and simplification of reality
(the model ignores negligible details of the natural
process & focuses on essential manifestations).
• It yields reproducible results and consequently, can be
used for predictive purposes.
– E.g., if the force on an object and its mass are known,
Eq. (1.3) can be used to compute acceleration.
7
Mathematical Modeling
• Mathematical models of physical phenomena may be
much more complex, and either cannot be solved
exactly or require more sophisticated mathematical
techniques than simple algebra for their solution.
• To illustrate a more complex model, Newton's second
law can be used to determine the terminal velocity of a
free-falling body near the earth's surface.
• Our falling body will be a bungee jumper (Fig. 1.1).
• For this case, a model can be derived by expressing the
acceleration as the time rate of change of the velocity
(dv/dt) and substituting it into Eq. (1.3) to yield:
dv/dt = F/m …………… (1.4)
8
Mathematical Modeling
• Fig. 1.1 Schematic diagram of
the forces acting on a falling
parachutist:
• FD is the downward force due to
gravity;
• FU is the upward force due to
air resistance.
9
Mathematical Modeling
• The change of the velocity is equal to the net force
acting on the body normalized to its mass.
– If the net force is positive, the object will accelerate.
– If it is negative, the object will decelerate.
– If the net force is zero, the object's velocity will remain at a
constant level.
• Next, we will express the net force in terms of
measurable variables and parameters.
• For a body falling within the vicinity of the earth, the
net force is composed of two opposing forces: the
downward pull of gravity FD and the upward force of
air resistance FU. From (Fig. 1.1):
F = FD + FU ……… (1.5) 10
Mathematical Modeling
• If force in the downward direction is assigned a
positive sign, the force due to gravity is:
FD = mg ……… (1.6)
where g is the acceleration due to gravity (9.81m/s2).
• Air resistance can be formulated in a variety of ways.
• Fluid Mechanics suggests that a first approximation
would be to assume that air resistance is linearly
proportional to velocity & acts in an upward direction.
FU = – Cdv ……… (1.7)
where Cd is a proportionality constant called the drag
coefficient (kg/m).
11
Mathematical Modeling
• Thus, the greater the fall velocity, the greater the
upward force due to air resistance.
• The parameter Cd accounts for properties of the falling
object, such as shape or surface roughness affecting air
resistance.
• For the present case, Cd might be a function of the type
of clothing or the orientation used by the jumper during
free fall.
• The net force is the difference between the downward
and upward force. Therefore, Eqs.(1.4) through (1.7)
can be combined to yield:
……….. (1.8)
12
Mathematical Modeling
• Equation (1.8) is a model that relates the acceleration
of a falling object to the forces acting on it.
• It is a differential equation because it is written in
terms of the differential rate of change (dv/dt) of the
variable that we are interested in predicting.
• However, in contrast to the solution of Newton's 2nd
law in Eq. (1.3), the exact solution of Eq. (1.8) for the
velocity of the jumper cannot be obtained using simple
algebraic manipulation.
• Rather, more advanced techniques such as those of
calculus must be applied to obtain an exact or
analytical solution.
13
Mathematical Modeling
• For example, if the jumper is initially at rest?
• (v = 0 at t = 0), advanced calculus can be used to solve
Eq. (1.8) for
…… (1.9)
15
Mathematical Modeling
Solution Example 1.1 continued …
• which can be used to compute
16
Mathematical Modeling
• According to the model, the parachutist accelerates
rapidly (Fig. 1.2).
17
Mathematical Modeling
• A velocity of 44.87 m/s is attained after 10 s.
• According to the model, the parachutist accelerates
rapidly (Fig. 1.2).
• A velocity of 44.87 m/s is attained after 10 s.
• Note also that after a sufficiently long time, a constant
velocity, called the terminal velocity, of 53.39 m/s is
reached.
• This velocity is constant because, eventually, the force
of gravity will be in balance with the air resistance.
• Thus, the net force is zero and acceleration has ceased.
• Velocity increases with time and asymptotically
approaches a terminal velocity. 18
Mathematical Modeling
• Equation (1.9) is called an analytical, or exact, solution
because it exactly satisfies the original differential
equation.
• Unfortunately, there are many mathematical models
that cannot be solved exactly.
• In many of these cases, the only alternative is to
develop a numerical solution that approximates the
exact solution.
• As mentioned previously, numerical methods are those
in which the mathematical problem is reformulated so
it can be solved by arithmetic operations.
19
Mathematical Modeling
• This can be illustrated for Newton’s second law by
realizing that the time rate of change of velocity can be
approximated by (see Fig. 1.3, next slide):
…… (1.10)
• where Δv and Δt = differences in velocity and time,
respectively, computed over finite intervals, v(ti) =
velocity at an initial time ti , and v(ti+1) = velocity at
some later time ti+1.
• Note that dv/dt ≈ Δv/Δt is approximate because Δt is
finite. Remember from calculus that,
20
Mathematical Modeling
• Figure 1.3 the use of a finite difference to approximate
the first derivative of v wrt t
21
Mathematical Modeling
• Equation (1.10) is called a finite divided difference
approximation of the derivative at time ti.
• It can be substituted into Eq. (1.8) to give
…… (1.11)
• Notice that the term in brackets is the right-hand side of
the differential equation [Eq. (1.8)] itself.
• That is, it provides a means to compute the rate of
22
change or slope of v.
Mathematical Modeling
• Thus, the differential equation has been transformed
into an equation that can be used to determine the
velocity algebraically at ti+1 using the slope and
previous values of v and t.
• Knowing an initial value for velocity at some time ti,
you can easily compute velocity at a later time ti+1.
• This new value of velocity at ti+1 can in turn be
employed to compute the velocity at ti+2 and so on.
• Thus, at any time along the way,
New value = old value + slope × step size
• Note that this approach is formally called Euler’s
Method. 23
Mathematical Modeling
Example 1.2
• Perform the same computation as in Example 1.1 but
use Eq. (1.11) to compute the velocity. Employ a step
size of 2 sec for the calculation.
Solution
• At the start of the computation (ti = 0), the velocity of
the parachutist is zero.
• Using the parameter values from Example 1.1, Eq.
(1.11) can be used to compute velocity at ti+1 = 2 s:
24
Mathematical Modeling
• For the next interval (from t = 2 to 4 s), the
computation is repeated, with the result
25
Mathematical Modeling
• The results are plotted in Fig. 1.4 (next slide)along
with the exact solution. It can be seen that the
numerical method captures the essential features of the
exact solution.
• However, because we have employed straight-line
segments to approximate a continuously curving
function, there is some discrepancy between the two
results.
• One way to minimize such discrepancies is to use a
smaller step size.
• For example, applying Eq. (1.11) at 1s intervals results
in a smaller error, as the straight-line segments track
26
closer to the true solution.
Mathematical Modeling
• Figure 1.4 Comparison of the numerical and analytical
solutions
27
Mathematical Modeling
• Each halving of the step size to attain more accuracy
leads to a doubling of the number of computations.
• Thus, we see that there is a trade-off between accuracy
and computational effort.
• Using hand calculations, the effort associated with
using smaller and smaller step sizes would make such
numerical solutions impractical.
• However, with the aid of the computer, large numbers
of calculations can be performed easily.
• Thus, you can accurately model the velocity of the
falling parachutist without having to solve the
differential equation exactly.
28
Conservation Laws in Engineering and Science
• Aside from Newton's second law, there are other major
organizing principles in science and engineering.
Among the most important of these are the
conservation laws. They all boil down to:
Change = Increase – Decrease ………. (1.12)
• This is precisely the format that we employed when
using Newton's law to develop a force balance for the
bungee jumper [(Eq. (1.8)].
• Although simple, Eq. (1.12) embodies one of the most
fundamental ways in which conservation laws are used
in engineering and science – that is, to predict changes
with respect to time. It is called the time-variable (or
29
transient) computation.
Conservation Laws in Engineering and Science
• Aside from predicting changes, another way in which
conservation laws are applied is for cases where change
is non-existent. If change is zero, Eq. (1.12) becomes:
Change = 0 = Increase – Decrease
OR
Increase = Decrease ………….. (1.13)
• This case, which is also given a special name – the
steady-state calculation – has many applications in
engineering and science.
• For the bungee jumper, the steady-state condition
would correspond to the case where the net force was
zero or [Eq. (1.8) with dv/dt = 0]. 30
Conservation Laws in Engineering and Science
mg = Cdv …………….. (1.14)
• Thus, at steady state, the downward and upward forces
are in balance and Eq. (1.14) can be solved for the
terminal velocity.
v = gm/Cd
• Although Eqs. (1.12) and (1.13) might appear trivially
simple, they embody the two fundamental ways that
conservation laws are employed in engineering and
science.
• As such, they will form an important part of our efforts
in subsequent chapters to illustrate the connection
between numerical methods and engineering science.
31
Some Models & Conservation Laws
F
32