Download as pdf or txt
Download as pdf or txt
You are on page 1of 47

MS3

MS
3200 Numerical Analysis
Part 2

Dr. Ir. Rachman Setiawan


Engineering Design Centre
(
(Mechanical
h
l Design Lab.)
b)
Tel. 2500979
E-mail: rachmans@edc.ms.itb.ac.id

8. Curve Fitting
8.1

Introduction

Purpose: To represent a function based on knowledge its


behaviour at certain discrete points.
p
There are two approaches:
Interpolation produces a function that matches the
given data exactly
Regression produces an approximate function for the
given data

Application:
Trend Analysis
Hypothesis testing

Source of Data:
Experimental data
Discrete numerical solution
57

Rac 2015

Interpolation (polynomial)

Regression (linear)

58

Comparison between Interpolation & Regression

Interpolation

Regression

The data is very precise


Curve fits each points exactly
Example: relationship generates
from exact solution/calculation

The data contains error or noise


Curve does not necessarily fit
each points exactly but
represents the general trend of
the data
Example: experimental result

59

Rac 2015

8.2
Interpolation
8.2.1 Newtons Divided-Difference

Making
g use of a Polynomial
y
form to fit a curve Polynomial
y
interpolation:

It requires (n + 1) datapoints for n-th order polynomial

While Polynomial is the form of fitting, one of the methods is


Newtons Divided-difference.
60

The simplest method of Newtons DD is by using Linear


form Linear Interpolation

f1 x f x0 f x1 f x0

x x0
x1 x0
f1 x f x0

Finite divided difference


approximation of
the first derivative

f x1 f x0
x x0
x1 x0

Datapoints: [x0, f(x0)], [x1, f(x1)]

61

Rac 2015

General form of Newtons Interpolating Polynomials


f n x b0 b1 x x 0 bn x x0 x x1 x x n 1

b0 f x 0

b1 f x1 , x 0

b2 f x 2 , x1 , x 0

bn f x n , x n 1 , , x1 , x 0
where

f xi , x j

f xi f x j
xi x j

f x n , x n 1 , , x1 , x 0

f x n , x n 1 , , x1 f x n 1 , , x1 , x 0
x n x0

62

Recursive nature of Newtons divided differences:

f n x f x 0 f x1 , x 0 x x 0 f x 2 , x1 , x 0 x x1 x x 0
f x n , x n 1 , , x1 , x 0 x x 0 x x1 x x n 1

63

Rac 2015

Algorithm
f( i) = yi
f(x
f x i , x j

f xi f x j
xi x j

First stage
-Second
S
d stage
t
-yint2 f2(x)
-Error

64

Effects on higher order (Ex 18.3):


Ln 2 = 0.6931472 (true value)

order

Data points
required

f(x)

t (%)

1st (linear)

0.4621

33.3

2nd

(quadratic)

0.5658

18.4

3rd

(cubic)

0.6288

9.3

65

Rac 2015

8.2.3 Lagrange
Form

i 0

j 0
j i

f n x Li x f xi ; Li x

x xj
xi x j

Rationale:
Each term of Li(xi) is 1 at x = xi and zero at all other
datapoints takes the value of f(xi) at data point xi.
Therefore, the curve passes through each data points A
characteristic
h
t i ti off IInterpolation
t
l ti

66

Example: Lagrange Interpolating polynomial orde-3


3

f 3 x Li x f xi L0 f x0 L1 f x1 L2 f x2 L3 f x3
i 0

x x1 x x2 x x3
x x0 x x2 x x3
f x0
f x1
f 3 x

x
x
x
x
x
x
2
0
3
0 1 0
x1 x0 x1 x2 x1 x3
x x0 x x1 x x3
x x0 x x1 x x2
f x2
f x3

x2 x0 x2 x1 x2 x3
x3 x0 x3 x1 x3 x2

67

Rac 2015

8.2.4 Interpolating Polynomial


Form

f n x a0 a1 x a2 x 2 ... an x n

Steps:
Build system of linear equations in form of matrix problem
Solve using ordinary Gauss/Gauss-Jordan/etc..

a0 a1 x0 a2 x0 ... an x0 f x0

1 x0

1 x1
1

1
1 x
n

a0 a1 x1 a2 x1 ... an x1 f x1
n

a0 a1 xn a2 xn ... an xn f xn
n

x0
2
x1

xn

n
x0 a0 f x0

n
x1 a1 f x1

a2 f x2


n
xn an f xn

68

8.2.5 Inverse Interpolation


Evenly-spaced

x = ??

f x 1.0000 0.5000 0.3333 0.2500 0.2000 0.1667 0.1429

Mostly unevenly-spaced
Sample Problem!!: Find x, to give f(x) = 0.3

69

Rac 2015

8.2.5 Inverse Interpolation


Obvious method:
Switching x f(x),
f(x) f(x) x ?? oscillation in result

Alternative method:
Interpolating polynomial, then root of polynomial
Steps:

Choose order of polynomials


Set up linear algebraic system
Find coefficients: a0, a1, ... , an
Solve for known f(x), to find x using root finding algorithm:

b a0 a1 x a2 x 2 ... an x n
a0 ' a1 x a2 x 2 ... an x n 0 where : a0 ' a0 b
Root finding problem
70

8.2.6. Spline Interpolation

Segmen I

Segmen II

Segmen III
...
1

Principles:
1. At first and end points, the
value of functions =
datapoints

f 1 x0 y0

f m xn y n

xi

2 At interior nots
2.
nots, the value
of adjacent functions must
be equal

f
jth Segment
ith data

xi

j 1

xi 1

71

Rac 2015

8.2.6. Spline Interpolation

Segmen I

Segmen II

Segmen III

Principles:
3. At interior nots, slope of
adjacent functions must be
equal

...

d
f
dx

xi

xi

d
f
dx

j 1

xi 1

4. Assume, the first point has


zero second
dd
derivative:
i ti

d2 I
f x0 0
dx 2

jth Segment
ith data

72

8.2.6. Spline Interpolation


Example: Quadratic Splines (Text Book EX. 18.9):
Quadratic: f

xi a j xi 2 b j xi c j

Datapoints: (3.0,2.5); (4.5,1.0); (7.0,2.5);(9.0,0.5)


Principles:
1

9a1 3b1 c1 2.5

81a1 9b1 c1 0.5

20.25a2 45b2 c2 1.0


49a2 7b2 c2 2.5
49a3 7b3 c3 2.5

9a1 b1 9a2 b2 0
14a2 b2 14a3 b3 0

20.25a1 45b1 c1 1.0

a1 0
73

Rac 2015

8.2.6. Spline Interpolation


Example: Quadratic Splines (Text Book EX. 18.9):

a1
...
b1

c1

a
2

...

c3

In Matrix form:

Solve for: a1, b1, c1, a2, ..., c3

f I x x 5.5

3.0 x 4.5

x 0.64 x 6.76 x 18.46


x 1.6 x 2 24.6 x 91.3

II

III

4.5 x 7.0
7.0 x 9.0
74

Other Advanced Topics:


8.2.5 Matrix Elimination coefficients*
8.2.6 Piece-wise Spline*
p

Self evaluation
Newtons DD:

f xn , xn 1 , , x1 , x0
f x2 , x1 , x0 ...

Lagrange:

f xn , xn 1 , , x1 f xn 1 , , x1 , x0
xn x0

i 0

j 0
j i

f n x Li x f xi ; Li x
f 2 x ...

x xj
xi x j

75

Rac 2015

10

8.3 Regression
8.3.1 Review on Statistics

Consider a p
population
p
of xi containing
g n members.
Mean/average:
n

Standard deviation:
n

sy

y
i 1

1
yi
n i 1

In a normalised form
Coefficient of variance

C OV

n 1

sy
y

atau
sy

2
i

yi

n n 1

76

Normal distribution
77

Rac 2015

11

If the population is composed of a number of


measurements, or numerical calculation:
Mean Accuracy (the closeness to the true value)
Standard deviation Precision (the closeness among
other members)

Regression makes use of this principle since, often, the


population is scattered due to random error (from
calculation or measurement)
Like in interpolation, the representing curve can be of the
form of linear, quadratic of general polynomial.
The big issue here is to choose the criteria for the best fit

78

8.3.2 The Best-fit Criterion

Supposed n data yi, to be fitted linearly (a0 + a1xi), so that containing


error/residual, e that is defined by:

ei yi a 0 a1 xi

The proposed criteria for Best fit :

Minimise the sum of errors

min ei

Minimise the sum of the absolute values of error

min ei

Minimise the maximum of the error (Minimax)

Minimise the sum of the squares of errors

minmax ei

min ei

79

Rac 2015

12

Alternatives of The Best-fit Criterion:

min ei

min ei

minmax ei

80

The best proposed criterion is chosen to be the Least


Squares Widely used in even more sophisticated
regressions and will be used for the entire discussion

S r yi ,measured yi , fit mod el

yi a0 a1 xi

81

Rac 2015

13

8.3.3 Quantification of Error of the Fitting


The error Sum of squares (SSE) Sr
Sr yi f xi

Other form: normalisation of SSE R-square (r2):


St Sr
St

r2

S t yi y

p
the relative discrepancy
p
y between squares
q
This represents
of errors and the spread of the original data, yi .
By taking square root Correlation coefficient (r).
For a perfect fit r = 1, for total non-correlated r = 0.

82

8.3.4 Least-Squares Linear Regression

Minimisation first derivatives = 0


For a0 :
For a1 :
S r yi a 0 a1 xi

Sr yi a0 a1 xi

S r
2 yi a0 a1 xi 0
a 0

Sr
2 yi a0 a1 xi xi 0
a1

yi xi a0 xi a1 xi 0

y a a x 0
y na a x
i

1 i

a0 xi a1 xi yi xi

Solving
g for the two equations:
q

a1

n xi yi xi yi
n xi2 xi

a 0 y a1 x

Example 17.1
83

Rac 2015

14

Use common sense to fit data, not necessarily linear. It could be


parabolic, exponential, logarithmic, etc
Linearization if necessary !

84

Linearization:
Know the basic relationship !
Modify
y the equation
q
into linear relationship
p

y a1e b1 x ln y ln a b1 x
y ' a0 a1 x

85

Rac 2015

15

* Favourite Text Book Problems:


17.6, compare the results with that of Ms Excel
17 13 compare the results with that of Ms Excel
17.13,

86

8.3.5 Polynomial Regression (Least Squares)


The minimisation of Sum of squares of errors (Least
Squares):
q
)
2
m 2
S r yi a0 a1 xi a 2 xi a m xi

That is by differentiate Sr wrt each a0, a1, am:

S
S
Sr
0; r 0,, r 0
a0
a1
am

Solving for the system of equations a0, a1, am

x
x

x
x
x

x
x
x

xim

xim1

xim2

n
i
2
i

i
2
i
3
i

2
i
3
i
4
i

a0 y i

a1 xi yi

a2 xi2 yi


xi2m am xim yi

x
x
x

m
i
m 1
i
m2
i

87

Rac 2015

16

8.3.6 n-Dimensional Space Regression


So far, we have 1 variable to regulate 1 function:
Example: x f (x)
Consider a problem with more than 1 variables to regulate
1 response function
Application: A phenomenon that is regulated by more than
one input variables.
The simplest form is Linear relationship having 2 input
variables (Multiple Linear Regression):

y a 0 a1 x1 a 2 x 2
So, the line in the two-dimensional space becomes flatplane in the three-dimensional space.

88

Two-dimensional linear regression


89

Rac 2015

17

The problem solving remains the same

Express the sum of the squares of errors, Sr


Differentiate Sr wrt each coefficients,, a0, a1, and a2.
Build a system of equations in matrix form
Solve it

x1i
x2 i

x
x
x x
1i
2
1i

1i

x
x x
x

a0

1i 2 i a1
2

2i a2
2i

2i

yi

x1i yi
x y
2i i

90

8.3.7 Advanced Topics

Non-linear regression
Fourier Approximation
Response Surface modelling
Metamodelling/Neural Network

91

Rac 2015

18

9. Numerical Integration
9.1 Introduction
Integration is summation with infinitesimally small division
g
is approximation
pp
of the integration
g
Numerical integration
with finite difference
b

I f x dx f n x dx
f n x a0 a1 x a n x n

92

9. Numerical Integration
9.1 Introduction
Basic Approach
Trapezoidal Concept

There are two approaches in


refining the approximate the
integral:
IIncrease the
th number
b off
sections
Use higher-order terms

93

Rac 2015

19

9. Numerical Integration
9.1 Introduction

Multiple-section approach

Higher-order-term approach

94

9. Numerical Integration
9.2 Trapezoidal Rule (Linear)
9.2.1 Basic Rule
b

I f x dx f1 x dx
f b f a
x a
ba
considering the area under the curve

f1 x f a

b a f b f a

2
Error (second degree) :
1
3
Et
f " b a
12

95

Rac 2015

20

9. Numerical Integration
9.2.2 Multiple Section

b a f x 2 f x f x
I
i
n
0
n 1

2n

1
1

1
1

i 1

Derivation Eq. 21.8 & 21.9

1
1

1
1

1
1

1
1
1

Error (summation of error


at all sections, still 2nd
degree):

Et

1 ba

12 n

f "
i

96

9. Numerical Integration

start

Programming realisation
FUNCTION Trapm (h,n,f)
sum = f0
DO I = 1, n-1
sum = sum + 2* fi
ENDDO
sum = sum + fn
Trapm = h*sum/2
END Trapm

end
97

Rac 2015

21

9. Numerical Integration
9.3 Simpsons Rule 1/3 (Quadratic)
9.3.1 Basic Rule
I

f x dx f x dx
2

x0 a ; x 2 b

f 2 x Second order Lagrange polynomial


ba
f x0 4 f x1 f x2
6
But, third-order accuracy (see Box. 21.3)

Et

1 ( 4) b a
f

90
2

b a 5
2880

f ( 4)

98

9.3.2 Multiple Aplication


I

ba
3n

n 1
n 2

f
x

4
f
x

2
f x j f xn

0
i
i 1, 3, 5 ,...
j 2 , 4 , 6 ,...

1
1

1
1
4

1 (4) b a
Et
f

90
2

1
1
4

1
1

99

Rac 2015

22

9.4 Simpsons 3/8 Rule


9.4.1 Basic Rule
I

f x dx f x dx
3

x0 a ; x2 b
I

ba
f x0 3 f x1 3 f x2 f x3
8

Comparison from 1/3 rule:


3/8 third order approximation,
approximation whilst 1/3 only second
order but with the same level of accuracy
1/3 rule requires 3 datapoints, whilst 3/8 4 datapoints
For multiple application, 1/3 rule is used for no. of points:
3, 5, 7, 9, , whilst 3/8 is used for no. of points: 4, 7, 10,
13 ,
100

9.5 Composite method


In order to adapt to the number of
segments,
g
, integration
g
can be
formed as a composite of
various previously described
methods, i.e. Simpsons 1/3,
and Simpsons 3/8 rules

101

Rac 2015

23

9.6 Higher Order

102

9.7 Open Integrals

103

Rac 2015

24

*Text Book Problems:


21.1 and 21.3
21.9
21 9
21.18

104

10. Integration of Equations


10.1 Introduction
Chapter 9 discusses methods to calculate the integral from
a number of discrete datapoints,
p
, e.g.
g experimental
p
results
Basically, the methods discussed previously is still
applicable. While not having datapoints, we have equation,
so solve the equation for any input data, xi (NewtonCotes)
However, different strategies are preferable!
Three approaches are available:
Recursive Roomberg
Roombergs
s integration
Gauss-Quadrature
Gauss-Legendre

105

Rac 2015

25

10. Integration of Equations


Roombergs Integration
Provides a way to combine two applications of the
Trapezoidal
p
rule with lower level of accuracy
y to compute
p
a
third estimate with higher accuracy
Richardsons Extrapolation

I I hm

1
I I
hl hm 2 1 m l

for h2 h1 / 2 Oh 4

4
1
I h2 I h1
3
3
16
1
I I m Il
15
15
64
1
I
Im Il
63
63
I

for hm hl / 4 Oh 6
for h2 h1 / 8 Oh8
106

10. Integration of Equations


Roombergs Integration
Richardson Extrapolation: Example 22.1:
Im = integral estimate with 1 segment,
segment and Il = integral
estimate with 2 segment, can be combined to reach the
third estimate:

1
4
1
4
I m I l 1.0688 0.1728 1.367467
3
3
3
3
t 16.6%
I

In general form:

I j ,k

4 k 1 I j 1,k 1 I j ,k 1
4

k 1

j : more or less accurate integral


k : level of integration

107

Rac 2015

26

10. Integration of Equations


10.2 Gauss Quadrature
Consider a linear approximation of
numerical integration
g
((Basic
Trapezoidal). Observe the error!
Now, by modifying the intersection
of the area and the curve, the
approximation could be more
accurate!

b
?

108

10. Integration of Equations


10.2.1 Gauss-Legendre (2-point)
Systematic implementation of 2-point gauss quadrature to
estimate third order integral
g
First, normalised the range of integration:
a to b
-1 to 1

109

Rac 2015

27

10. Integration of Equations


The method can approach up to cubic integrals:
y0 1
y1 x
y2 x

4 unknowns (c0, c1, x0, x1)


4 equations

I c0 f x0 c1 f x1

y3 x 3

c0 f a c1 f b

1dx 2

c0 c1 1

c0 f a c1 f b

x dx 0

x0

2
x dx 3

x1

c0 f a c1 f b

c0 f a c1 f b

1
0.5773505...
3

1
0.5773505...
3

x dx 0
1

110

10. Integration of Equations


Step-by-step Application
The integral variable, x, is transformed to new variable,
xd:
x

b a b a xd
2

b a dx
dx
2

Consequently, the integral equation is transformed to


using the above transformation relationship, to become:
b

I f x dx I d
a

f x dx
d

Then, solve the integral using Gauss-Quadrature with


known xo, x1, co, c1:I c f x c f x
0 d

1 d

111

Rac 2015

28

10. Integration of Equations


10.2.2 Gauss-Legendre (Higher points)

I c0 f x0 c1 f x1 cn f xn
With 2*(n+1) coefficients, it could solve system of
polynomial equations for the order up to {2*(n+1)-1}, to
give c0, c1, cn (weights), and x0, x1, xn (function
arguments)
Hence, accurate for polynomial with order up to
{2*(n+1)-1}.

112

10. Integration of Equations


10.2.2 Gauss-Legendre (Higher points)

113

Rac 2015

29

10. Integration of Equations


10.3 Improper Integrals

114

10. Integration of Equations


10.3 Improper Integrals
Transform infinite integration limit to finite limit (x 1/t)
b

1/ a

f x dx t
a

1/ b

1
2

1
f dt
t

a, b

Set the datapoints at sufficiently close to infinity


Use Open integral method, e.g. Midpoint method (Tab.
21.4):
3
3

f x dx h 2 f x f x 2 f x

xn

n2

x0

n 1

115

Rac 2015

30

11. Numerical Differenti


Differentiation
ation
Use Finite-divided-difference to estimate f(x),
f (x), ...
f(x)
Alternative Methods:
Forward FDD: accuracy O(h) Fig. 23.1
Backward FDD: accuracy O(h) Fig. 23.2
Centered FDD: accuracy O(h2) Fig. 23.3

Another alternative method to increase accuracy


Richardson extrapolation
1
D Dhm
D D
hl hm 2 1 m l
116

12. Differential Equations


12.1 Introduction
Differential equations that will be solved are in form of:
dy
f x, y
dx
Recall the approximation by Taylor series:
dy
yi 1 yi h
dx
yi 1 yi f xi , yi h
The numerical solution for the diff. equation
q
solves for yi at
each desired input xi
It requires one initial condition, x0.
The method is then called Eulers method (linear)

117

Rac 2015

31

12. Differential Equations


Type of Problems to be solved:
We know the slope at any point (dy/dx)
Solve for each position,
position y

Example:
Falling parachutist
Free vibration

118

12. Differential Equations


Problems:
Truncation, due to discretization of x in predicting y,
g of 2 p
parts:
consisting
Local truncation error
Propagated truncation error

f xi 1 f xi f ' xi h

f ' ' xi 2 f ' ' ' xi 3


h
h ...
2!
3!
(truncated)

Round-off, caused by limited numbers of significant digits


that can be retained by computer

119

Rac 2015

32

12. Differential Equations


Improvement (smaller step size)

120

12. Differential Equations


Improvement (higher order)
Midpoint method

121

Rac 2015

33

12. Differential Equations


12.2 Higher order methods
Heuns method:
yi ' f xi , yi is used to extrapolate a Predictor

yi01 yi f xi , yi h
The slope at the predictor is calculated and then used to
estimate a better general slope, as a Corrector to the
previous slope (average)
y 'i 1 f xi 1 , yi01
yi 1 yi01 y ' h
y ' y 'i 1
y' i
2
The next predicted result is, then:
0
Or: Predictor : yi 1 yi f xi , yi h

Corrector : yi 1 yi

f xi , yi f xi 1 , yi01
h
2

122

12. Differential Equations


Improvement (higher order)
Heuns method

123

Rac 2015

34

12. Differential Equations


12.3 Runge-Kutta
Runge-Kutta methods are generalisation as well as
extension of the p
previous two methods ((Heuns dan Midpoint)
The following general form, hence, can be used:

yi 1 yi xi , yi , h h

a1k1 a2k2 an kn
n represents the order of approximation: second-order,
thi d d
third-order,
etc
t
k1 f xi , yi

k2 f xi p1h, yi q11k1h

k3 f xi p2h, yi q21k1h q22k2h

kn f xi pn 1h, yi qn 1,1k1h qn 1, 2k2h qn 1,n 1 , kn 1h

124

12. Differential Equations


Imagine, as in Heun and Midpoint, the algorithm contains
two important steps:
Calculation of p and q.
Calculation of k

Before actually calculating the next y


Heun and Midpoint belong to second order Runge-Kutta
(RK2), with certain p, q, k.
Description Eq. 25.36 to 25.38

125

Rac 2015

35

12. Differential Equations


Various types of Runge-Kutta:
Second order (RK2):

1
1
yi 1 yi k1 k 2 h
2
2
k1 f xi , yi

(Heun)

k 2 f xi h, yi k1h
yi 1 yi k 2 h

k1 f xi , yi

1
1

k 2 f xi h , yi k1h
2
2

2
1
yi 1 yi k1 k 2 h
3
3
k1 f xi , yi

(Mid-point)

(Ralston)

3
3

k 2 f xi h , yi k1h
4
4

126

12. Differential Equations


Third order (RK3):
yi 1

1
yi k1 4 k 2 k 3 h
6

1
k1 4 k 2 k3 h
6
k1 f xi , yi
yi 1 yi

1
1

k 2 f xi h , yi k1h
2
2

k 3 f xi h , yi k1h 2 k 2 h

Fourth order (RK4):


yi 1 yi

1
k1 2 k 2 2k 3 k 4 h
6

k1 f xi , yi
1
1

k 2 f xi h , yi k1h
2
2

1
1

k 3 f xi h , y i k 2 h
2
2

k 4 f xi h , y i k 3 h
127

Rac 2015

36

12. Differential Equations


Graphical Description of Slope Modification in R-K

Heun (R-K 2)

R-K 4
128

12. Differential Equations


Comparison

129

Rac 2015

37

12. Differential Equations


Systems of ODE
dy1
f1 x , y1 , y 2 ,..., y n
d
dx
dy 2
f 2 x , y1 , y 2 ,..., y n
dx

dy n
f n x , y1 , y 2 ,..., y n
dx
Initial condition:

x 0 , y10 , y 20 ,..., y n0

Selected: step size,

130

Boundary--value Problem
Boundary
Heat transfer: from hotter surface, T1, to cooler surface T2,
in one-dimensional medium (rod)

Thot

Tcool

d 2T
h ' Ta T x 0
dx 2
Known: Th, and Tc.
Find: temperature distribution at the medium

131

Rac 2015

38

Boundary--value Problem
Boundary
Solution Strategy#1: Shooting method

d 2T
h ' Ta T x 0
dx 2
d dT

h ' T Ta
dx dx
dz
dT

z;
h ' T Ta
dx
dx

One 2nd order ODE


becomes
Two 1st ODEs
(system of ODEs)

Steps:
Assume z(0) calculate to find Tn
if Tn known Tc, Assume z(0),
Interpolate to find appropriate z(0) use for overall
solution, T (x).

Example 27.1
132

Boundary--value Problem
Boundary
Strategy #2: Finite difference

d 2T
h ' Ta T x 0
dx 2
T 2Ti Ti 1
i 1
h ' Ta Ti 0
x 2

Grid model:
x

T0=Th

T1

T2

Tn = Tc

133

Rac 2015

39

Boundary--value Problem
Boundary
For each step, build system of equation:
T2 2T1 T0
T 2T1 Th
h ' Ta T1 0 2
h ' Ta T1 0
2
x
x 2
T3 2T2 T1
h ' Ta T2 0
x 2

Th = Hot temp
(known)
Th = Cold temp
(known)

Tn 2Tn 1 Tn 2
T 2Tn 1 Tn 2
h ' Ta Tn 1 0 c
h ' Ta Tn 1
2
x
x 2
a11
a
12

a12 a1n T0 b1
T b
a22
1 2

ann Tn 1 bn

Matrix of Linear
Algebraic Equation
Solve for Ts (temperature
Distribution)

134

Boundary--value Problems
Boundary
Buckling
Analytical Approach

d2y M
d 2 y Py
d2y

p2 y 0
dx 2 EI
dx 2
EI
dx 2
135

Rac 2015

40

Boundary--value Problems
Boundary
Analytical approach: Eigenvalue
Numerical approach: Finite difference:

d2y
p2 y 0
2
dx
y 2 y i y i 1
i 1
p 2 yi 0
2
x
y i are deflection of the column at position xi
(see Boundary Value Problems Procedure above)

136

Eigenvalue Problems
General Form

A I X 0

Possible solutions:
{X} = 0, i.e. all x-s zero trival (useless)
[[A]-[I]] = {0}, i.e. det [[A]-[I]] = 0 non-trivial, with
usefull {X}

Hence, the latter solution is sought after:


d t [[A]
det
[[A]-[I]]
[I]] = 0 polinomial
li
i l off (roots
(
t off polynomial
l
i l
search)

Solve for i using methods of Muller or Bairstow, or even


simpler methods as in Roots of equation problems.

137

Rac 2015

41

Eigenvalue Problems
Alternate method: Power Method

A I X 0
AX X

X i 1 A X i

(iterative search for )

The result: the largest


Eigenvalue.
In order to obtain
the smallest Eigenvalue,
[A] [A]-1, with the result
of (Eigenvalue)-1.

Procedure:
1.
2.
3.
4.

Trial of {X}, and solve for [A]{X}


Find and {Xnew}
Feed {Xnew} for [A]{Xnew}
Repeat the process until error is small enough
138

Eigenvalue Problems
Application #1: Mohrs Circle
State of stress
x xy

ij yx y
zx zy
Find Principal

x 1
yx
zx

xz

yz
z

Stresses:

xy
xz
y 2 yz 0
z 2
zy

3 I1 2 I 2 I 3 0
1 , 2 , 3 (principal stresses)

Root finding of Third order


Polynomial Equation Problem

139

Rac 2015

42

Eigenvalue Problems
Application #2: MDOF Vibration

F 0

m1 x1 k 2 x1 x2 0

m2 x2 k x1 2 x2 0
First Approach: Mixed numerical-analytical
Trial solution:

xi Ai sin t
140

Eigenvalue Problems
xi Ai sin t

xi Ai 2 sin t

m1 x1 k 2 x1 x2 0

m1 A1 2 sin t k 2 A1 sin t A2 sin t 0

m1 A1 2 k 2 A1 A2 0
m2 x2 k x1 2 x2 0

m2 A2 2 sin t k A1 sin t 2 A2 sin t 0


m2 A2 2 k A1 2 A2 0
k

2
2 m
1

m2

A1 0

k
2
2 A2 0

m2

k
m1

Eigenvalue Problem

141

Rac 2015

43

Eigenvalue Problems
Solution:
Natural frequencies: 1 and 2
Mode Shape:
p A1 and A2 for each mode

142

Partial Differential Equations


General Form

2u
2u
2u
A 2 B
C 2 D 0
x
xy
y
Classification

143

Rac 2015

44

Partial Differential Equations


Elliptic Equations
Example:

Math Function:
2T 2T
0

x 2 y 2

Name : Laplace equation


Problem: Find temperature
distribution over 2D area
with known boundary
values

144

Partial Differential Equations


Elliptic Equations

2T 2T
0

x 2 y 2

Numerical Approach

Ti 1, j 2Ti , j Ti 1, j

Ti , j 1 2Ti , j Ti , j 1

x
y 2
if we set square grid, x y, hence :
Ti 1, j Ti 1, j Ti , j 1 Ti , j 1 4Ti , j 0
2

aT b
T ...

Temp. Distribution
over area

Matrix of Linear Algebraic Equations!


145

Rac 2015

45

Partial Differential Equations


Parabolic Equations
Example:

Math Function:

T
2T
k' 2
t
x

Name: Heat conduction equation


P bl
Problem:
Temperature
T
t
distribution
di t ib ti
over a rod length at
different time

146

Partial Differential Equations


Parabolic Equations
Numerical Approach

T
2T
k' 2
t
x

T l 2Ti l Ti l 1
Ti l 1 Ti l
k ' i 1
t
x 2

set the constant parameter : k '

Ti l 1 Ti l Ti l 1 2Ti l Ti l1

t
x 2

T0=Th

T1

T2

Tn = Tc
147

Rac 2015

46

Partial Differential Equations


Hyperbolic Equations
Example:

Math Function:

2 y 1 2 y

x 2 c 2 t 2

Wave equation

148

Rac 2015

47

You might also like