Professional Documents
Culture Documents
Material Semana 2
Material Semana 2
Material Semana 2
Functions
http://numericalmethods.eng.usf.edu
Forward Difference
Approximation
lim f ( x + Δx ) − f ( x )
f ′( x ) =
Δx → 0 Δx
For a finite ' Δx'
f (x + ∆x ) − f ( x )
f ′( x ) ≈
∆x
3 http://numericalmethods.eng.usf.edu
Graphical Representation Of
Forward Difference
Approximation
f(x)
x x+Δx
4 http://numericalmethods.eng.usf.edu
Example 1
The upward velocity of a rocket is given as a function of time in Table 1.
5 http://numericalmethods.eng.usf.edu
Example 1 Cont.
Solution
To find the acceleration at t = 16s, we need to choose the two values
closest to t = 16s, that also bracket t = 16s to evaluate it. The two
points are t = 15s and t = 20s.
ν (ti +1 ) −ν (ti )
a(ti ) ≈
∆t
ti = 15
ti +1 = 20
∆t = ti +1 − ti
= 20 − 15
=5
6 http://numericalmethods.eng.usf.edu
Example 1 Cont.
ν (20) −ν (15)
a(16) ≈
5
517.35 − 362.78
≈
5
≈ 30.914 m/s 2
7 http://numericalmethods.eng.usf.edu
Direct Fit Polynomials
In this method, given ' n + 1' data points ( x0 , y 0 ), ( x1 , y1 ), ( x 2 , y 2 ), , ( x n , y n )
one can fit a n th order polynomial given by
Pn (x ) = a0 + a1 x + + an −1 x n −1 + an x n
Pn′( x ) = = a1 + 2a 2 x + + (n − 1)a n −1 x n −2 + na n x n −1
dPn ( x )
dx
8 http://numericalmethods.eng.usf.edu
Example 2-Direct Fit Polynomials
The upward velocity of a rocket is given as a function of time in Table 2.
Using the third order polynomial interpolant for velocity, find the
acceleration of the rocket at t = 16 s .
9 http://numericalmethods.eng.usf.edu
Example 2-Direct Fit Polynomials cont.
Solution
For the third order polynomial (also called cubic interpolation), we choose the velocity given by
v(t ) = a 0 + a1t + a 2 t 2 + a3 t 3
Since we want to find the velocity at t = 16 s , and we are using third order polynomial, we need
to choose the four points closest to t = 16 s and that also bracket t = 16 s to evaluate it.
a0 = −4.3810
a1 = 21.289
a2 = 0.13065
a3 = 0.0054606
Hence
12 http://numericalmethods.eng.usf.edu
Example 2-Direct Fit Polynomials cont.
= 29.664m/s 2
14 http://numericalmethods.eng.usf.edu
Lagrange Polynomial
In this method, given ( x1 , y1 ),, ( xn , yn ) , one can fit a (n − 1)th order Lagrangian polynomial
given by
n
f n ( x) = ∑ L ( x) f ( x )
i =0
i i
where ‘ n ’ in f n (x) stands for the n th order polynomial that approximates the function
y = f (x) given at (n + 1) data points as (x0 , y 0 ), (x1 , y1 ),......, (x n −1 , y n −1 ), (x n , y n ) , and
n x − xj
Li ( x) = ∏
j =0 xi − x j
j ≠i
15 http://numericalmethods.eng.usf.edu
Lagrange Polynomial Cont.
Then to find the first derivative, one can differentiate f n (x ) once, and so on
f 2 (x ) =
(x − x1 )(x − x2 ) f (x ) + (x − x0 )(x − x2 ) f (x ) + (x − x0 )(x − x1 ) f (x )
(x0 − x1 )(x0 − x2 ) 0 (x1 − x0 )(x1 − x2 ) 1 (x2 − x0 )(x2 − x1 ) 2
16 http://numericalmethods.eng.usf.edu
Lagrange Polynomial Cont.
′ 2 x − ( x1 + x2 ) 2 x − ( x0 + x2 ) 2 x − ( x0 + x1 )
f 2 (x ) = f ( x0 ) + f ( x1 ) + f (x )
(x0 − x1 )(x0 − x2 ) (x1 − x0 )(x1 − x2 ) (x2 − x0 )(x2 − x1 ) 2
f 2′′( x ) = f ( x0 ) + f ( x1 ) + f ( x2 )
2 2 2
(x0 − x1 )(x0 − x2 ) (x1 − x0 )(x1 − x2 ) (x2 − x0 )(x2 − x1 )
17 http://numericalmethods.eng.usf.edu
Example 3
The upward velocity of a rocket is given as a function of time in Table 3.
18 http://numericalmethods.eng.usf.edu
Example 3 Cont.
Solution
t − t1 t − t 2 t − t0 t − t 2 t − t0 t − t1
v(t ) = v(t 0 ) + v(t1 ) + v(t 2 )
t 0 − t1 t 0 − t 2 t1 − t 0 t1 − t 2 t2 − t0 t 2 − t1
2t − (t1 + t 2 ) 2t − (t 0 + t 2 )
a(t ) = ν (t 0 ) + ν (t1 ) + 2t − (t0 + t1 ) ν(t2 )
(t 0 − t1 )(t 0 − t 2 ) (t1 − t 0 )(t1 − t 2 ) (t2 − t0 )(t2 − t1 )
2(16 ) − (15 + 20 )
a(16) = (227.04) + 2(16) − (10 + 20) (362.78) + (20
2(16 ) − (10 + 15)
(517.35)
(10 − 15)(10 − 20) (15 − 10)(15 − 20) − 10 )(20 − 15)
= 29.784m/s 2
19 http://numericalmethods.eng.usf.edu