Download presentation
Presentation is loading. Please wait.
Published byNoel Randall Pope Modified over 6 years ago
1
Taylor series in numerical computations (review, cont.)
Class V
2
Last time We reviewed a definition of Taylor series.
We considered examples of Taylor expansions for several well known functions and applied them to estimate the values of some of them at specific values of their arguments, ln(1.1) and exp(8). The conclusion we drew: a Taylor series converges rapidly near the point of expansion and slowly (or not at all) at more remote points. We looked at the behavior of a few partial sums of a Taylor series for sin(x) and exp(x) that confirmed the above conclusion: more terms are needed with x deviating from the expansion point. We reformulated Taylor series for F(x+h).
3
In this lecture: We will continue consider other examples of Taylor series, their properties and some useful applications
4
Expansion of f(x+h) An expansion of f(x+h) about point x can be written as 𝒇 𝒙+𝒉 =𝒇 𝒙 + 𝒇 ′ 𝒙 𝒉+ 𝒇 ′′ 𝒙 𝒉 𝟐 𝟐! + 𝒇 𝟑 𝒙 𝒉 𝟑 𝟑! + …+ 𝒇 𝒏 𝒙 𝒉 𝒏 𝒏! + 𝑬 𝒏+𝟏 where the error term is given as 𝐸 𝑛+1 = 𝒇 𝒏+𝟏 (𝝃) 𝒉 𝒏+𝟏 (𝒏+𝟏)! and 𝑥< 𝜉<𝑥+ℎ (h positive) or 𝑥+ℎ< 𝜉<𝑥 (h is negative) Note that 𝐸 𝑛+1 ~ 𝒉 𝒏+𝟏 . As h converges to 0, 𝐸 𝑛+1 converges to 0 as fast as 𝒉 𝒏+𝟏 . This relation is expressed as 𝐸 𝑛+1 = O( 𝒉 𝒏+𝟏 ) (big O notation) and is equivalent to |𝐸 𝑛+1 | ≤𝑪 | 𝒉 𝒏+𝟏 | where C is a constants.
5
Expansion of f(x+h) with the error term can be written for any n=0,1,2
𝐸 𝑛+1 = 𝒇 𝒏+𝟏 (𝝃) 𝒉 𝒏+𝟏 (𝒏+𝟏)! = O( 𝒉 𝒏+𝟏 ) n=0 𝒇 𝒙+𝒉 =𝒇 𝒙 + 𝒇 ′ 𝝃 𝒉= 𝒇 𝒙 + O(𝒉) n=1 𝒇 𝒙+𝒉 =𝒇 𝒙 + 𝒇 ′ 𝒙 𝒉+ 𝒇 ′′ 𝝃 𝒉 𝟐 𝟐! =𝒇 𝒙 + 𝒇 ′ 𝒙 𝒉+ O( 𝒉 𝟐 ) n=3 𝒇 𝒙+𝒉 =𝒇 𝒙 + 𝒇 ′ 𝒙 𝒉+ 𝒇 ′′ 𝒙 𝒉 𝟐 𝟐! + 𝒇 𝟑 𝝃 𝒉 𝟑 𝟑! =𝒇 𝒙 + 𝒇 ′ 𝒙 𝒉+ 𝒇 ′′ 𝒙 𝒉 𝟐 𝟐! +O( 𝒉 𝟑 )
6
Example: expand sqrt(1+h) in powers of h. Then compute sqrt(1
Example: expand sqrt(1+h) in powers of h. Then compute sqrt( ) and sqrt( ) Calculate derivatives of function f(x) = sqrt(x)= 𝑥 1/2 Use Taylor expansion with x=1 and expand f(x+h):
7
Example: expand sqrt(1+h) in powers of h. Then compute sqrt(1
Example: expand sqrt(1+h) in powers of h. Then compute sqrt( ) and sqrt( ) Calculate derivatives of function f(x) = sqrt(x)= 𝑥 1/2 Use Taylor expansion with x=1 and expand f(x+h) taking n=2 1+ℎ = ℎ − ℎ ℎ 3 𝜉 −5/2 Here 1< 𝜉<1+ℎ (h positive) Let h=10^(-5). Calculate the approximate value of sqrt( ). 3. Substitute –h for h in the above equation 1−ℎ =1− 1 2 ℎ − ℎ 2 − ℎ 3 𝜉 −5/2 4. Estimate the error
8
Alternating series Suppose we have a series: S = a1 – a2 + a3 – a4 + … Then if magnitudes of the terms converge monotonically to 0, i.e. a1 ≥ a2 ≥ a3 ≥ ... ≥ a_n ≥ .... ≥ 0 for all terms, and lim_{n->infinity} a_n = 0 Then the error in truncating the series is no larger than the magnitude of the first ommited term: S – exact series, S_n – the sum up to n term, |S – S_n| ≤ a_{n+1} Example: S = ln(2) = ln (1+1) ~ 1 – 1/2 + 1/3 – 1/4 + … + (-1)^{n-1} / n = S_n Then the error |S – S_n| ≤ 1/(n+1) If we want the error to be less than 0.5*10^{-6), then 1/(n+1) < 0.5*10^{-6) leading to n ~ 2*10^6 - two million terms are needed.
9
Example: estimate sin(x)/x, limit of x -> 0?
10
Example: estimate sin(x)/x, limit of x -> 0?
Recall that
11
Example: estimate sin(x)/x, limit of x -> 0?
Recall that 𝑛=0 ∞ (−1) 𝑛 𝑥 2𝑛 2𝑛+1 ! sin 𝑥 𝑥 = The first term (n=0) is 1 𝑥 2(𝑛+1) 2𝑛+3 ! Error: |S – S_n| ≤ a_{n+1} =
12
Example: estimate sin(x) - x
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.