Solve and provide MATLAB code. (b) Write a function, MyCenteredDifference, that takes in a function f, a
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(b) Write a function, MyCenteredDifference, that takes in a function f, a point (or points) x, and a step size h that represents the spacing between the x points. The function should return an approximated derivative of f using centered differences at each x point. Using your function, approximate the derivative Dh f' using step sizes h = for n = 1,2, 3, ..., 15 on the interval [1, 2]. Compare the results of your function to the true derivatives f'(x) = 3x² + cos(x) by computing the error 2n En = max |f'(x) - Dh(x)| X Print your results in and the error ratio a table that has as columns: n, the error En(x), En (x) En-1(a) where E₁ (x) Eo (x) 1. = (b) Write a function, MyCenteredDifference, that takes in a function f, a point (or points) x, and a step size h that represents the spacing between the x points. The function should return an approximated derivative of f using centered differences at each x point. Using your function, approximate the derivative Dh f' using step sizes h = for n = 1,2, 3, ..., 15 on the interval [1, 2]. Compare the results of your function to the true derivatives f'(x) = 3x² + cos(x) by computing the error 2n En = max |f'(x) - Dh(x)| X Print your results in and the error ratio a table that has as columns: n, the error En(x), En (x) En-1(a) where E₁ (x) Eo (x) 1. =
Expert Answer:
Answer rating: 100% (QA)
Define the function fx and its true derivative fx fX 3x2cosx trueder... View the full answer
Related Book For
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis
Posted Date:
Students also viewed these databases questions
-
A manufacturer built a new head office building and pald the following amounts: land ($100,000), building ($150,000]. Parking lot ($20,000) and landscaping ($8,000). What would be the maximum tax...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Let f: RR be a differentiable function such that its derivative f' is continuous and f(n) = 6. If F: [0, 1 by F(x) = f(t)dt, , and if ] R is defined (f'(x)+F(x)) cosx dx = 2 0 then the value of f(0)...
-
In its first year of business, Solinger Company purchased land, a building, and equipment on November 5, 2013, for $700,000 in total. The land was valued at $262,500, the building at $337,500, and...
-
Show how to modify Dijkstras algorithm to not only output the distance from v to each vertex in G, but also to output a tree T rooted at v, such that the path in T from v to a vertex u is actually a...
-
As the head of public health, you conduct a weekly census across age-groups of the number of cases of flu reported in your area. By hand, compute the mean and the median by week. Which do you think,...
-
The production supervisor of the Machining Department for Gilman Company agreed to the following monthly static budget for the upcoming year: Gilman Company Machining Department Monthly Production...
-
What is the competition in the construction industry, how can companies compete?
-
Palmer, a U.S. company, acquired 90% of Scalas voting stock for $32,600 in cash on January 1, 2019, when Scalas book value was $5,000. The fair value of the noncontrolling interest at the date of...
-
197. A 22-year-old man developed painful swelling of his left knee and gives a history of diarrhoea 3 weeks back which resolved in 3 days. Testing for gonorrhoea is negative. Reactive arthritis...
-
Describe how you would adopt a balanced score card approach to evaluate your project performance. Your response should identify specific measures you would use as well as the approach you would take...
-
Based on the synopsis of the LeadClick case. Who has or should have primary responsibility for managing fake news and its consequences (i.e., social media companies, advertising companies,...
-
Place the following phrases in an internet search bar and, describe the following. Please provide a citation and reference for each source you use. Feedback and empowerment What does the ability to...
-
How can I find the exact p-value for each coefficient (p>t )column if the number of observations = 52, df numerator is 3, df denominator is 48, t static is there in the third column. I need to know...
-
Briefly explain at least 5 tools and techniques you have learned in the previous classes that are used by operations managers to improve the processes, lower costs and meet the demand of their...
-
1. Mark each statement True or False: And explain your answer : (a) Let G be a group and H be a subgroup of G. Then H is a subgroup of its normalizer N(H). (b) The dihedral group D, can be expressed...
-
a. Show that the expansion of q(x) in ascending powers of x can be approximated to 10 2x + Bx 2 + Cx 3 where B and C are constants to be found. b. Find the percentage error made in using the series...
-
Use co-factor expansion to prove that the determinant of an nn upper triangular matrix U is the product of the entries along its diagonal, n det U = Uij i=1
-
Consider the Lorenz equations with parameters = 10, b = 8/3, and r = 28. Employ initial conditions of x(0) = y(0) = z(0) = 5 and integrate from t = 0 to 20. Use the RungeKutta fourth-order method...
-
Consider the solution of the differential equation by an implicit Euler scheme. Determine the form of the residual and Jacobian that you would need to compute the values for time step i + 1. y"+yy +...
-
Cavett Problem. A process having multiple recycle loops formulated by R.H. Cavett [Proc. Am. Petrol. Inst., 43, 57 (1963)] has been used extensively to test tearing, sequencing, and convergence...
-
Consider the ammonia process in which \(\mathrm{N}_{2}\) and \(\mathrm{H}_{2}\) (with impurities \(\mathrm{Ar}\) and \(\mathrm{CH}_{4}\) ) are converted to \(\mathrm{NH}_{3}\) at high pressure...
-
Use a process simulator to model a two-stage compression system with an intercooler. The feed stream consists of \(95 \mathrm{~mol} \%\) hydrogen and \(5 \mathrm{~mol} \%\) methane at \(100^{\circ}...
Study smarter with the SolutionInn App