
Concept explainers
Compute forward and backward difference approximations of O(h) and O(h2), and central difference approximations of O(h4) for the first derivative of y=cosx at x=π/4 using a value of h=π/12. Estimate the true percent relative error εt for each approximation.

To calculate: The forward and backward difference approximations of O(h) and O(h2), and central difference approximations of O(h2) and O(h4) for the first derivative of y=cosx at x=π4 using a value of h=π12. Also find the true percent error ε, for each approximation.
Answer to Problem 1P
Solution:
Forward difference approximation of O(h) is −0.79108963 with true percent error ε=−11.877%
Forward difference approximation of O(h2) is −0.72601275 with true percent error ε=−2.674%
Backward difference approximation of O(h) is −0.60702442 with true percent error ε=14.154%
Backward difference approximation of O(h2) is −0.71974088 with true percent error ε=−1.787%
Central difference approximation of O(h2) is −0.69905703 with true percent error ε=1.138%
Central difference approximation of O(h4) is −0.70699696 with true percent error ε=0.016%
Explanation of Solution
Given information:
Function, y=cosx
Step size, h=π12
The initial value of x, x=π4
Formula used:
Forward difference approximation of O(h) is,
f′(xi)=f(xi+1)−f(xi)h
Forward difference approximation of O(h2) is,
f′(xi)=−f(xi+2)+4f(xi+1)−3f(xi)2h
Backward difference approximation of O(h) is,
f′(xi)=f(xi)−f(xi−1)h
Backward difference approximation of O(h2) is,
f′(xi)=3f(xi)−4f(xi−1)+f(xi−2)2h
Central difference approximation of O(h2) is,
f′(xi)=f(xi+1)−f(xi−1)2h
Central difference approximation of O(h4) is,
f′(xi)=−f(xi+2)+8f(xi+1)−8f(xi−1)+f(xi−2)12h
xi+1=xi+h Here i=0,1,2,...
True percent relative error is,
ε=(exact value − numerical valueexact value)×100
Calculation:
Consider the function,
f(x)=cosx
First derivation of the function is,
f′(x)=−sinx
Thus, the true value of the first derivative of y=cosx at x=π4 is,
f′(π4)=−sin(π4)=−0.70710678
The value of xi−2 is,
xi−2=xi−2h=π4−2(π12)=π12=0.261799388
The value of the function at xi−2=0.261799388 is,
f(0.261799388)=cos(0.261799388)=0.965925826
The value of xi−1 is,
xi−1=xi−h=π4−(π12)=0.523598776
The value of the function at xi−1=0.523598776 is,
f(0.523598776)=cos(0.523598776)=0.866025404
The value of xi is,
xi=π4=0.785398163
The value of the function at xi=0.785398163 is,
f(0.785398163)=cos(0.785398163)=0.707106781
The value of xi+1 is,
xi+1=xi+h=π4+π12=1.047197551
The value of the function at xi+1=1.047197551 is,
f(1.047197551)=cos(1.047197551)=0.5
The value of xi+2 is,
xi+2=xi+2h=π4+2(π12)=1.308996936
The value of the function at xi+2=1.308996936 is,
f(1.308996936)=cos(1.308996936)=0.258819045
Forward difference approximation of O(h) is,
f′(xi)=f(xi+1)−f(xi)h
For y=cosx forward difference approximation is,
f′(xi)=0.5−0.707106781(π12)=−0.2071067810.261799388=−0.79108963
True percent error is,
ε=(exact value − numerical valueexact value)×100=((−0.70710678)−(−0.79108963)(−0.70710678))×100=−11.877%
Forward difference approximation of O(h2) is,
f′(xi)=−f(xi+2)+4f(xi+1)−3f(xi)2h
For y=cosx forward difference approximation is,
f′(xi)=−0.258819045+4(0.5)−3(0.707106781)2(π12)=−0.380139388(π6)=−0.72601275
True percent error is,
ε=(exact value − numerical valueexact value)×100=((−0.70710678)−(−0.72601275)(−0.70710678))×100=−2.674%
Backward difference approximation of O(h) is,
f′(xi)=f(xi)−f(xi−1)h
For y=cosx backward difference approximation is,
f′(xi)=0.707106781−0.866025404(π12)=−0.158916230.261799388=−0.60702442
True percent error is,
ε=(exact value − numerical valueexact value)×100=((−0.70710678)−(−0.60702442)(−0.70710678))×100=14.154%
Backward difference approximation of O(h2) is,
f′(xi)=3f(xi)−4f(xi−1)+f(xi−2)2h
For y=cosx backward difference approximation is,
f′(xi)=3(0.707106781)−4(0.866025404)+0.9659258262(π12)=−0.376855447(π6)=−0.71974088
True percent error is,
ε=(exact value − numerical valueexact value)×100=((−0.70710678)−(−0.71974088)(−0.70710678))×100=−1.787%
Central difference approximation of O(h2) is,
f′(xi)=f(xi+1)−f(xi−1)2h
For y=cosx central difference approximation is,
f′(xi)=0.5−0.8660254042(π12)=−0.366025404(π6)=−0.69905703
True percent error is,
ε=(exact value − numerical valueexact value)×100=((−0.70710678)−(−0.69905703)(−0.70710678))×100=1.138%
Central difference approximation of O(h4) is,
f′(xi)=−f(xi+2)+8f(xi+1)−8f(xi−1)+f(xi−2)12h
For y=cosx central difference approximation is,
f′(xi)=−(0.258819045)+8(0.5)−8(0.866025404)+0.96592582612(π12)=−2.221096451π=−0.70699696
True percent error is,
ε=(exact value − numerical valueexact value)×100=((−0.70710678)−(−0.70699696)(−0.70710678))×100=0.016%
Therefore, Forward difference approximation of O(h) is −0.79108963 with true percent error ε=−11.877%
Forward difference approximation of O(h2) is −0.72601275 with true percent error ε=−2.674%
Backward difference approximation of O(h) is −0.60702442 with true percent error ε=14.154%
Backward difference approximation of O(h2) is −0.71974088 with true percent error ε=−1.787%
Central difference approximation of O(h2) is −0.69905703 with true percent error ε=1.138%
Central difference approximation of O(h4) is −0.70699696 with true percent error ε=0.016%
Want to see more full solutions like this?
Chapter 23 Solutions
Numerical Methods for Engineers
- Consider a simplified version of American football where on any possession ateam can earn 0, 3 or 7 points. What is the smallest number n0 of points such that for all n ≥ n0 and n ∈ Na team could earn n points. You must prove that your answer is correct via induction (HINT: Don’t forgetto show that n0 is the smallest number above which any number of points is reachable).arrow_forwardConsider a vocabulary consisting of the nucleotide bases V = {A, T, G, C}.Construct a DFA to recognize strings which end in AAGT .(a) Draw the DFA with clear markings of all states including start and acceptance state(s).(b) Simulate the DFA to show that string T GAAGT will be accepted by the DFA.(c) Simulate the DFA to show that string T AAGT G will not be accepted by the DFA.arrow_forwardA palindrome is a string that reads the same backward as it does forward. For example, abaaaba is a palindrome. Suppose that we need to define a language that generates palindromes.(a) Define a phase structure grammar that generates the set of all palindromes over the alphabet {a, b}clearly describing the recursive rules that generates palindromes. Use the notation Symbol → rule. Theempty set is denoted by λ. Clearly identify the terminal and non-terminal symbols in your grammar.(b) Show that the palindrome abaaaba can be recognized by your grammar. To show this, show all stepsof parsing the expression abaaaba using the rules you defined above.arrow_forward
- A full k-ary tree is a (rooted) tree whose nodes either have exactly k children (internal nodes) or have no children (leaves). Using structural induction, formally prove that every full k-ary tree that has x internal nodes has exactly kx + 1 nodes in total. Note that for full binary trees, i.e., when k = 2, this would imply that the total number of nodes is 2x + 1.arrow_forwardW AutoSave Off Soal Latihan Matdis (1) ▼ Search File Home Insert Draw Design Layout References Mailings Review View Help Aptos (Body) ✓ 12 A A Aa Ро Paste BI U ab x, x² A ✓ A ད Clipboard ₪ 24 23 22 21 20 19 18 17 16 15 1″ ידידיו Page 1 of 1 25°C 215 words Berawan E> M Font 四 Paragraph 3 4 1 56 ☑ 781 LI Comments Editing Find ✓ Normal No Spacing Heading Replace Add-ins Select Styles ☑ Editing Add-ins 91 10 111 12 | 13| 14 15 5. Suppose you wanted to draw a quadrilateral using the dots below as vertices (corners). The dots are spaced one unit apart horizontally and two units apart vertically. a) How many quadrilaterals are possible? b) How many are squares? How many are rectangles? c) How many are parallelograms? English (Indonesia) Accessibility: Investigate R - W ☑ Share ▾ Focus + 100% 00:17 13/04/2025arrow_forward2. Show that 8 xa S -dx (b² + 12) dr = 2 cos(π2) пра-1 a, b real and -1 0 Your solution should clearly explain the closed contour you are using, and state clearly any vanishing properties of integrals over contours that are being used. You are free to quote from the lectures, the appropriate results on such vanishing properties, without deriving these properties. Any residue calculations involved should be explained clearly.arrow_forward
- 1. Calculate the integral 500 x sin x (a² +x2)20 dx by using the residue theorem. You may assume that a is real and a > 0. Your solution should clearly explain the closed contour you are using, and state clearly any vanishing properties of integrals over contours that are being used.arrow_forwardSteel Production Planning: Let S represent the amount of steel produced (in tons). Steel Production is related to the amount of labor used(L) and the amount of capital used ( C ) by the following function:S = 20L⁰˙³⁰C⁰˙⁷⁰In this formula L represents the units of Labor input and C the units of Capital input. Each unit of Labor costs $50, and each unit of Capital costs $100. a:Formulate an optimization problem that will determine how much labor and capital are needed to produce 50,000 tons of steel at minimum cost. Q#3B: Solve the optimization problem you formulated in part (a). (Hint: When using Excel Solver, start with an initial L>0 and C>0.)…arrow_forwardQ/Draw the graph k 3,4, and extract perfect ma ching from itarrow_forward
- Functions and Change: A Modeling Approach to Coll...AlgebraISBN:9781337111348Author:Bruce Crauder, Benny Evans, Alan NoellPublisher:Cengage LearningAlgebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:CengageTrigonometry (MindTap Course List)TrigonometryISBN:9781337278461Author:Ron LarsonPublisher:Cengage Learning

