ES 84 Numerical Methods
Motivation
Two main methods of solving an engineering problem:
1. Analytical methods
Provide the exact solution for the equation(s) governing the engineering system.
Give insight to the behavior of the system.
Usually not applicable to complex geometries and/or systems with nonlinear behavior why?
2. Numerical methods
Provide a numerical result that is an approximation of the exact solution.
Can be used to analyze complex geometries and/or nonlinear systems
Requires tedious iterative computations
In this course we will learn how to use the above approximation and similar
approximations to solve equations.
Optimization
Curve fitting and interpolation
Numerical differentiation
Numerical integration
Solving Ordinary Differential Equations (ODE)
f (CD) = 0
Problem: What is the drag
coefficient, CD?
Is it possible to solve
analytically for CD?
Problem: Estimate the tool life for the cutting speed of 190 m/min.
Which of the below two approaches more suitable for this problem?
Numerical Differentiation
Measured velocity of a car during a crash test.
Velocity, Vx (inches/s)
X 100
Time (s)
Data and video: http://rockyroer.blogspot.com.tr/2011/11/crash-test-data.html
Numerical Integration
The cross section of a racing
sailboat is shown.
The sails apply a distributed load
on the mast.
Problem: What is the total force
on the mast?
F is in lb/ft.
Solution of ODEs
The mirror of a solar heater
All the incident light rays should reflect
through a single point (focus).
The shape of the mirror is governed by the
equation:
Programming
Algorithm: Sequence of logical steps required to perform a specific task.
Example 2: Write a computer program to calculate sin(x) using the following series
expansion.
Algorithm
Pseudocode, Flowchart
Pseudocode
INPUT x, N
SIN = 0
LOOP k from 1 to N
SIN = SIN + (-1)k+1* x2k-1/ (2k-1)!
END LOOP
OUTPUT x, SIN
put comments:
explain variables, purpose of code segments, etc.
Testing
run with typical data
run with unusual but valid data
run with invalid data to check error handling
Programming (continued)
What do you need to know about programming?
Basic programming skills that you studied in CSc 101
Scilab syntax
data types (integers, single vs. double precision, arrays, etc.)
loops, if statements
input / output
etc.
Advice on learning SCILAB
Refresh your programming knowledge by studying the Scilab tutorials.
Approach the problem through the algorithm-pseudocode-computer code sequence.
See the course web site for other useful links.
Significant Figures
Designate the reliability of a number.
Number of significant figures to be used in a number depends
on the origin of the number.
Consider the calculation of the area of a circle, A = D2/ 4
(preferred)
Approximate Error
Approximate Error: Ea= Present Approx Value Past Approx Value
Relative Approximate Error (fractional):
a= Ea / Present Approx Value
Relative Approximate Error (percentage):
a= (Ea / Present Approx Value) * 100%
(preferred)
Scarborough criteria:
If the tolerance is selected to be s= 0.5x102-n%, then the
approximation is guaranteed to be correct to at least n digits(see
Problem 3.10, 6thed).
Types of Error
Round-Off Errors
Computers cannot use infinite number of digits to store numbers.
Conversion from base 10 to base 2 may create problems.
(0.1)10= (0.00011 00011 00011 00011 )2
Some numbers such as or 1/3 can not be represented exactly.
Repeat the calculation using increments of -1. Adding numbers starting from the
smallest is known to result in less round-off error.
Taylor Series
Example:
Evaluate f(x) = x4 using first order Taylor series approximation around xi = 1 for
different values of h.
Read Chapra & Canale Chapter 4: Truncation Errors and Taylor Series
nth order Taylor series expansion will be exact if f(x) is an nth order polynomial. Rn
will have (n+1)th derivative which is zero.
In general, approximations for f(xi+1) gets better as the order of the approximation
increases, and as h decreases.
If the expansion is around zero, then it is called the Maclaurin Series.
Error Propagation
How does error propagate in mathematical formulae?
For functions of a single variable, f(x):
Example 8:
Example 9:
Wind tunnel experiments on a
race car were performed to
understand its drag
characteristics
Determine the error in the drag
coefficient using the data
provided.
Mathematical Definitions
Significant figures
Sources of error
Taylor series
Error propagation
END