Anda di halaman 1dari 39

Deret dan

Aproksimasi
Deret MacLaurin
Deret Taylor
Tujuan

• Kenapa perlu perkiraan?


– Perkiraan dibentuk dari fungsi paling sederhana –
polynomial.
– Kita bisa mengintegrasikan dan mendiferensiasi
dengan mudah.
– Kita bisa gunakan saat kita tidak tahu fungsi
sebenarnya.
Polynomial Approximations
• Misalkan kita ingin membuat perkiraan untuk sebuah
fungsi yang kompleks pada sekitar x = 0;
• Perkiraan paling simple adalah menentukan sebuah
konstanta, sehingga:
p0 ( x )  a 0
• Catatan: perkiraan di atas disebut sebagai zero’th order
polynomial approximation;
• Lalu, nilai berapa yang harus kita berikan pada
konstanta itu?
Polynomial Approximations
• Kita inginkan angka paling akurat pada x = 0.
• Sehingga: p0 ( x)  f (0)
2 f(x)

1.5

1 p (x)

0.5
-1 -0.5 0 0.5
x
Polynomial Approximations
• Contoh

1
f ( x) 
1 x

1
f (0)   1  p0 ( x)  1
1
Polynomial Approximations

2 f(x)

Tidak akurat Kurang akurat

1.5

1 p 0 (x)

Sangat
akurat
0.5
-1 -0.5 0 0.5
x
Polynomial Approximations
• Sekarang kita tingkatkan dengan perkiraan
dengan menggunakan aproksimasi linier
(1st order approximation);
p1 ( x)  a0  a1 x
• Sekarang kita pilih nilai sehingga perpotongan
dan garis nya semirip mungkin dengan fungsi
sebenarnya.
Polynomial Approximations
• Menyamakan perpotongan:
p1 (0)  f (0)  a0  a1  0  f (0)
 a0  f (0)

• Menyamakan slope:
p1 (0)  f (0)  a1  f (0)

• Sehingga polinom nya:


p1 (0)  f (0)  f (0) x
Polynomial Approximations
• Contoh
1
f ( x) 
1 x
p1 ( x)  a0  a1 x
1
f ( 0)   1  a0  f (0)  1
1 0
1
f (0)   1  a1  f (0)  1
1  x  2

 p1 ( x)  1  x
Ingat, Metode Newton Raphson

tangent dy
tangent   f'
f(xi) dx
f  xi   0
f '  xi  
xi  xi1
rearrange
xi f  xi 
xi+1 xi1  xi 
f '  xi 
Polynomial Approximations
2 f(x)

2 f(x)

1.5 p 1 ( x)
1.5
Masih ‘lumayan’ sampai disini
y y

1 p 0 ( x)
1 p 0 ( x)

0.5
-1 -0.5 0 0.5
x

0.5
-1 -0.5 0 0.5
x
Polynomial Approximations
• Sekarang coba dengan perkiraan kuadratik:

p2 ( x)  a0  a1 x  a2 x 2

• Kita inginkan perpotongan, gradient dan kurva


(turunan kedua) dari perkiraan kita dapat match
dengan fungsi sebenarnya pada x = 0.
Polynomial Approximations
• Menyamakan perpotongan:

p2 (0)  f (0)  a0  a1  0  a2  0  f (0)


2

 a0  f (0)

• Menyamakan kemiringan:

p2 (0)  f (0)  a1  2a2  0  f (0)


Polynomial Approximations
• Mencocokkan kurva (turunan ke 2):
p2(0)  f (0)  2a2  f (0)
1
 a2  f (0)
2
• Memberikan polinom
1
p2 ( x)  f (0)  f (0) x  f (0) x 2
2
Polynomial Approximations
• Contoh
1
f ( x) 
1 x
p2 ( x)  a0  a1 x  a2 x 2

• Dari sebelumnya: a0  1, a1  1
2
f ( x)   2a2  f (0)  2
1  x  3

 a2  1

 p2 ( x )  1  x  x 2
Polynomial Approximations
2 f(x)

2 p 2 (x)f(x)

1.5 p 1 ( x)

Lebih ‘lumayan’ lagi ya..


1.5 p 1 ( x)

1 p 0 ( x)
1 p 0 ( x)

0.5
0.5 -1 -0.5 0 0.5
-1 -0.5 x 0 0.5
x
Polynomial Approximations
• Kita bisa teruskan penaksiran secara polinom
hingga n derajad.
• Kalau kita teruskan, kita akan mendapatkan
rumus:

f ( x)  pn ( x)  f (0)  f (0) x
2 n
x x
 f (0)    f (0)
(n)

2! n!
Polynomial Approximations
• Akurasi perkiraan akan bertambah seiring
dengan penambahan polinom;
• Kita lihat polinom derajad 0, 1, 2 dan 6 (warna
hijau), dibanding fungsi asli nya f(x) (warna
biru).
2 Polynomial Approximations f(x)

p 6 (x)
p 2 (x)

1.5 p 1 (x)

1 p 0 (x)

0.5
-1 -0.5 0 0.5
x
Maclaurin (Power) Series
• Deret Maclaurin adalah penaksiran polinom derajad tak
hingga
f ( x)  f (0)  f (0) x
x2 x n
 f (0)    f ( n ) (0)  
2! n!
• Notice: Deret infinite (tak hingga) menyatakan bahwa
akhirnya deret ini sama dengan fungsi sebenarnya,
bukan penaksiran lagi!
Taylor Series

• Dari awal kita selalu memulai


perkiraan pada nilai x  0
• Sesungguhnya, kita bisa membuat
deret polinom yang berasal dari
titik manapun. x  x0
• Ini disebut Taylor Series.
• Jadi, Deret MacLaurin
merupakan Deret Taylor yang
berpusat pada x0=0
Taylor Series

• Rumus umum Deret Taylor:


( x  x0 ) 2
f ( x)  f ( x0 )  f ( x0 )( x  x0 )  f ( x0 )
2!
( x  x ) n
   f ( n ) ( x0 ) 0

n!


( x  x ) n
 f ( n ) ( x0 ) 0

n 0 n!
Taylor Series

• Approximate function? Copy derivatives!

1.0 What is f(x) near x=0.35?


f(x)=sin(2x)

0.5

0.0

-0.5

-1.0

0.00 0.25 0.50 0.75 X 1.00


Taylor Series

• Approximate function? Copy derivatives!

1.0 What is f(x) near x=0.35?


f(x)=sin(2x)

0.5

0.0
T0 ( x)  f (0.35)
-0.5

-1.0

0.00 0.25 0.50 0.75 X 1.00


Taylor Series

• Approximate function? Copy derivatives!

1.0 What is f(x) near x=0.35?


f(x)=sin(2x)

0.5

0.0
T1 ( x)  f (0.35)
-0.5  f '(0.35)  x  0.35 
-1.0

0.00 0.25 0.50 0.75 X 1.00


Taylor Series

• Approximate function? Copy derivatives!

1.0 What is f(x) near x=0.35?


f(x)=sin(2x)

0.5
T2 ( x)  f (0.35)
0.0

-0.5  f '(0.35)  x  0.35 


-1.0

 f ''(0.35)  x  0.35 
1 2
0.00 0.25 0.50 0.75 X 1.00
2
Taylor Series

• Approximate function? Copy derivatives!

1.0 What is f(x) near x=0.35?


T10 ( x)
f(x)=sin(2x)

0.5
T2 ( x)  f (0.35)
0.0

-0.5  f '(0.35)  x  0.35 


-1.0

 f ''(0.35)  x  0.35  
1 2
0.00 0.25 0.50 0.75 X 1.00
2

 a  x  a
(i ) i
N
f
TN ( x)  
i 0 i!
Taylor Series

• Approximate function? Copy derivatives!

1.0
Most Common: 1st Order
f(x)=sin(2x)

0.5

0.0
T1 ( x)  f (a) 
-0.5 f '(a )  x  a 
-1.0

0.00 0.25 0.50 0.75 X 1.00


• Look out for “approximate” or “when x is small”
or “small angle” or “close to” …
Contoh – Taylor Series

• Bentuklah Deret Taylor untuk:

f ( x)  ln( x), x0  1

• Cari nilai fungsi dan turunannya


untuk fungsi pada x0=1
Contoh – Taylor Series

f ( x)  ln( x)  f ( x0 )  ln(1)  0
1 1
f ( x)   f ( x0 )   1
x 1
1 1
f ( x)   2  f ( x0 )   2  1
x 1
2 2
 
f ( x)  3  f ( x0 )  3  2
x 1

n 1
( n  1)! ( 1 )
f ( n ) ( x) 
xn
n 1
( n  1 )! ( 1) n 1
 f ( n ) ( x0 )   ( n  1)! ( 1)
1n
Contoh – Taylor Series
• Gunakan Rumus Umum Deret Taylor:
( x  x0 ) 2
f ( x)  f ( x0 )  f ( x0 )( x  x0 )  f ( x0 )
2!
( x  x ) n
   f ( n ) ( x0 ) 0

n!
( x  1) 2 2!( x  1)3
 ln( x)  0  ( x  1)  
2! 3!
n 1 ( x  1)
n
   (n  1)!(1) 
n!
( x  1) ( x  1)
2 3
 ln( x)  ( x  1)  
2 3
( x  1 ) n
   (1) n 1 
n
Truncated Taylor Series
• We cannot evaluate a Taylor series – it is
infinite!
• Kita bisa memutuskan untuk membuat perkiraan
dari sebuah fungsi hingga n (derajat) tertentu
yang tidak tak terhingga;
• Kita sebut sebagai Truncated Taylor Series.
Truncated Taylor Series
• To find an nth order truncated Taylor series
( x  x0 ) 2
f ( x)  f ( x0 )  f ( x0 )( x  x0 )  f ( x0 )
2!
( x  x ) n
   f ( n ) ( x0 ) 0
n!

• Note: This is the same concept as the


polynomial approximations we introduced
earlier.
Example – Truncated Taylor Series

• Find a cubic (degree 3) truncated


Taylor series for the function:
f ( x)  cos(2 x)

centered at: 
x
4
Example – Truncated Taylor Series

• For a degree 3 approximation:

f ( x)  f ( x0 )  f ( x0 )( x  x0 )
( x  x0 )
2
( x  x0 ) 3
 f ( x0 )  f ( x0 )
2! 3!

• So we need to evaluate the function


and its first three derivatives at the
center.
Example – Truncated Taylor Series

• Evaluating these:
   
f ( x)  cos( 2 x)  f    cos   0
4 2
   
f ( x)  2 sin( 2 x) 
 f    2 sin    2
4 2
   
f ( x)  4 cos( 2 x)  f    4 cos   0
4 2
   
f ( x)  8 sin( 2 x)  f    8 sin    8
4 2
Example – Truncated Taylor Series
• … which gives:
f ( x)  f ( x0 )  f ( x0 )( x  x0 )
( x  x0 ) 2 ( x  x0 )3
 f ( x0 )  f ( x0 )
2! 3!
 
 f ( x)  0  2   x  
 4
2 3
   
x  x 
 4  4
 0  8
2! 3!
3
   4  
 f ( x)  2 x     x  
 4  3 4
Example – Truncated Taylor Series

 /4 t 3 ( x)
1 f(x)

0.8
p3 ( x)
0.6 cos(2 x)
0.4

0.2

y
0

-0.2

-0.4

-0.6

-0.8

-1

x0  
-3 -2 -1 0 1 2 3
x

4
Series Accuracy
• Kenapa mesti pakai Deret Taylor kalau bisa pakai
Maclaurin?
• Perkiraan kita akan makin jauh dari akurat jika semakin
jauh dari titik awal x0;
• Kita harus selalu memakai titik awal yang dekat dengan
titik yang akan diperkirakan dan juga mudah untuk
melakukan perkiraan.

Anda mungkin juga menyukai