Examen Metodos Numericos
Examen Metodos Numericos
Examen Metodos Numericos
Methods
[ ]
b. U {x} = {d } ⇒ Solve for {x} by backward subs.
= (1 − λ )x + λx
k +1 k * weighted average
x solution
1. Solve Equation (1) for x1, Eq (2) for x2, Eq (3) for x3
2. Start iterative procedure by guessing: xo1 ,xo2 ,xo3
3. Calculate x11 from xo2 ,xo3
4. Calculate x12 from x11 ,xo3
5. Calculate x13 from x11 ,x12
6. Repeat for new x’s
Convergence Check:
xik − xik −1
ε a ,i = k
• 100% < ε s
xi
GS Convergence Criteria:
n
aii > ∑ aij
j =1
j ≠i
S r = ∑ e =∑ ( yi − ao + a1 xi ) = ∑ ( yi ,meas − yi ,mod )
N N N
2 2 2
i
i =1 i =1 i =1
Minimize Sr and solve for a’s Æ How?
Sy =
⎛
⎜ ∑ (
yi − y ) ⎞⎟
2
⎜ n −1 ⎟
⎝ ⎠
2. Standard Error Estimate: What does it measure?
⎛ ∑ ( yi − a0 − a1 xi )2 ⎞
Sy/x =⎜ ⎟
⎜ n − 2 ⎟
⎝ ⎠
S r = ∑ ( yi − a0 + a1 xi )
2
St − S r
r =
2
St
St − S r Correlation
r=
St coefficient
CH. 17 Least Squares Regression
(B) Non-Linear Relationships: convert to linear
1. Exponential y = a1eb1x
Power Model y = a2 x
b2
2.
x
3. Saturation Growth Rate y = a3
b2 + x
(C) Polynomial Regression
y = a0 + a1 x + a1 x 2 + ... + am x m + e
• Follow minimization procedure from linear regression
⎛ Sr ⎞
Sy/x = ⎜⎜ ⎟⎟
⎝ n − (m + 1) ⎠
CH. 21 Numerical Integration
Integrate data & functions
f n ( x) = a0 + a1 x + a2 x 2 + ... + an −1 x n −1 + an x n
∫ f (x
−1
d )dxd = c0 f ( x0 ) + c1 f ( x1 ) = ∫ 1dxd = 1
−1
1 1
∫ f (x
−1
d )dxd = c0 f ( x0 ) + c1 f ( x1 ) = ∫ xd dxd = 0
−1
1 1
∫
−1
f ( xd )dxd = c0 f ( x0 ) + c1 f ( x1 ) = ∫ xd2 dxd = 2 / 3
−1
1 1
∫
−1
f ( xd )dxd = c0 f ( x0 ) + c1 f ( x1 ) = ∫ xd3 dxd = 0
−1
Solving we obtain:
co = c1 = 1
xo = − x1 ⎛ −1 ⎞ ⎛ 1 ⎞ 2pt Gauss-Legendre
I ≈ f⎜ ⎟+ f⎜ ⎟
⎝ 3⎠ ⎝ ⎠ Forumula
−1 3
xo =
3
CH. 22 Numerical Integration
(B) Gauss Quadrature Æ Apply 2pt formula to an
integral of the form:
b−a
[ ]
b
I =∫ f ( x)dx ≈ c0 f ( xotrans ) + c1 f ( x1trans )
a
2
To transform the x-locations we use:
b+a b−a
x= + xd
2 2
b−a
dx = dxd
2
Substituting the Gauss points for the 2pt formula we obtain:
b + a b − a ⎛ −1 ⎞
x trans
o = + ⎜ ⎟
2 2 ⎝ 3⎠
b+a b−a⎛ 1 ⎞
x trans
1 = + ⎜ ⎟
2 2 ⎝ 3⎠
CH. 25 Runge-Kutta Methods
• Classification of Differential Equations
• Solution of ODE’s Note: I have
• Initial Value Problems posted handout
• Boundary Value Problems
online for
Solve ODE’s of the form: classification
dy
= f ( x, y )
dx
Numerical Solution form: Step size
yi +1 = yi + φh
New slope
Current
estimate value
1. Euler’s Method
yi +1 = yi + f ( xi , yi )h
• Local truncation error – O(h2)
• Global truncation error – O(h)
CH. 25 Runge-Kutta Methods
2. Huen’s Method – Predictor/Corrector
• Predictor Equation
yi0+1 = yi + f ( xi , yi )h
• Corrector Equation
f ( xi , yi ) + f ( xi +1 , y )
0
yi +1 = yi + i +1
h
2
Average slope
yi +1 = yi + (k1 + 2k 2 + 2k3 + k 4 )h
1
6
yi +1 = yi + φh
Slope Estimates:
k1 = f ( xi , yi )
k 2 = f ( xi + 0.5h, yi + .5k1h)
k3 = f ( xi + 0.5h, yi + .5k 2 h)
k 4 = f ( xi + h, yi + k3 h)
dy
=z
dx yi +1 = yi + ϕ1h
dz zi +1 = zi + ϕ 2 h
= −az − c sin y
dx
y (0 ) = 1
z (0 ) = −1
CH. 27 Boundary Value Problems
1. Shooting Method
• Convert a boundary value problem into
an initial value problem.
• Solve the problem iteratively
T(x)
z1
Exact
z2 x
• Linear ODE Approach
• Non-Linear ODE Approach
CH. 27 Boundary Value Problems
2. Finite Difference Equations
• Alternative to the shooting method
• Substitute finite difference equations
for derivatives in the original ODE.
• This will give us a set of simultaneous
algebraic equations that are solved a
nodes using techniques like Gauss-
Seidel, LU Decomposition, etc.
∂ 2T ∂ 2T
+ 2 = R ( x, y )
∂x 2
∂y