1. log(ni/ni+1) Consider the function f(x) = = sin(x). Approximate the derivative f'() with central, forward and backward differences for values h = 0.2, 0.1, 0.05, 0.01, 0.005, 0.001, 0.0005, 0.0001 and plot the graph of the error [f'(π) - Df(π)] for the corresponding values of h.

Advanced Engineering Mathematics
10th Edition
ISBN:9780470458365
Author:Erwin Kreyszig
Publisher:Erwin Kreyszig
Chapter2: Second-order Linear Odes
Section: Chapter Questions
Problem 1RQ
icon
Related questions
Question
• Numerical differentiation: Consider a smooth function f(x). The central difference approxima-
tion to the first derivative for small h> 0 is
Def(x) =
while f'(x) = Dcf(x) + Ch² for some constant C that depends on f". Discarding the error term
we have f'(x) ≈ Dcf(x).
Similarly we define the forward difference approximation to the first derivative for small h as
Df f(x) =
and the backward difference approximation
f(x+h)-f(x - h)
2h
1.
P =
Dbf(x)
with truncation error of O(h). There is a general numerical procedure to determine the order of
accuracy of the approximation (i.e. the exponent p in the error formula Chp): We consider a problem
with known solution. In our case we consider a given function f(x) and values h = h₁, h₂, hn
with hi+1 <hi. We compute the quantity Df(x) and the exact value f'(x) and then we compute
the error E; = |ƒ'(x) – Dƒ(x)| for each hi. This error must be E; = Ch. Taking the values E;
and E₁+1 we can approximate the order p as follows: We compute the fraction
Ei/Ei+1 = (hi/hi+1)P
and then using logarithms and solving for p we get the approximation
log(Ei/Ei+1)
log(hi/hi+1)
ƒ(x + h) − f (x)
-
h
=
f(x) - f(x - h)
h
Consider the function f(x) = sin(x). Approximate the derivative f'(π) with central,
forward and backward differences for values h = 0.2, 0.1, 0.05, 0.01, 0.005, 0.001, 0.0005,
0.0001 and plot the graph of the error |ƒ'(π) – Dƒ(7)| for the corresponding values of h.
Transcribed Image Text:• Numerical differentiation: Consider a smooth function f(x). The central difference approxima- tion to the first derivative for small h> 0 is Def(x) = while f'(x) = Dcf(x) + Ch² for some constant C that depends on f". Discarding the error term we have f'(x) ≈ Dcf(x). Similarly we define the forward difference approximation to the first derivative for small h as Df f(x) = and the backward difference approximation f(x+h)-f(x - h) 2h 1. P = Dbf(x) with truncation error of O(h). There is a general numerical procedure to determine the order of accuracy of the approximation (i.e. the exponent p in the error formula Chp): We consider a problem with known solution. In our case we consider a given function f(x) and values h = h₁, h₂, hn with hi+1 <hi. We compute the quantity Df(x) and the exact value f'(x) and then we compute the error E; = |ƒ'(x) – Dƒ(x)| for each hi. This error must be E; = Ch. Taking the values E; and E₁+1 we can approximate the order p as follows: We compute the fraction Ei/Ei+1 = (hi/hi+1)P and then using logarithms and solving for p we get the approximation log(Ei/Ei+1) log(hi/hi+1) ƒ(x + h) − f (x) - h = f(x) - f(x - h) h Consider the function f(x) = sin(x). Approximate the derivative f'(π) with central, forward and backward differences for values h = 0.2, 0.1, 0.05, 0.01, 0.005, 0.001, 0.0005, 0.0001 and plot the graph of the error |ƒ'(π) – Dƒ(7)| for the corresponding values of h.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Recommended textbooks for you
Advanced Engineering Mathematics
Advanced Engineering Mathematics
Advanced Math
ISBN:
9780470458365
Author:
Erwin Kreyszig
Publisher:
Wiley, John & Sons, Incorporated
Numerical Methods for Engineers
Numerical Methods for Engineers
Advanced Math
ISBN:
9780073397924
Author:
Steven C. Chapra Dr., Raymond P. Canale
Publisher:
McGraw-Hill Education
Introductory Mathematics for Engineering Applicat…
Introductory Mathematics for Engineering Applicat…
Advanced Math
ISBN:
9781118141809
Author:
Nathan Klingbeil
Publisher:
WILEY
Mathematics For Machine Technology
Mathematics For Machine Technology
Advanced Math
ISBN:
9781337798310
Author:
Peterson, John.
Publisher:
Cengage Learning,
Basic Technical Mathematics
Basic Technical Mathematics
Advanced Math
ISBN:
9780134437705
Author:
Washington
Publisher:
PEARSON
Topology
Topology
Advanced Math
ISBN:
9780134689517
Author:
Munkres, James R.
Publisher:
Pearson,