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
-
fin510: Considering all else remains constant, if a firm is using a restricted policy of financing assets, it will have a level of assets, a assets turnover ratio, and consequently, a return on equity
-
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)...
-
Refer to the trial balance for Taggar Enterprises Inc. prepared in P3-9A. In addition to this information, note that during the year, common shares in the amount of $2,000 were issued and $1,250 of...
-
Given that cos = 1/7 and that is acute, find the exact values of a. sin b. tan c. tan cos d. sin 2 + cos 2 e. cos tan /1 cos 2 .
-
The adjusting entries for the following adjustments were omitted at year-end: a. Prepaid insurance expired, $2,400. b. Depreciation, $1,800. c. Employee salaries owed for Monday through Wednesday of...
-
1. a. Explain why the court concluded that destination skiers at Deer Valley or at Deer Valleys mid-mountain village constitute a market separate from ski rental outlets in nearby Park City. b. How...
-
You are the facility manager for Yale University. The last regular season men's basketball game is scheduled for tonight at 7 pm versus Princeton. The game has seeding implications for the Ivy League...
-
Find R ab in the four-way power divider circuit in Fig. 2.135 . Assume each R = 4 . ww- ww- ER ER R. :R
-
What do you see as your biggest areas of personal development as a leader
-
Review the article provided, "The Truth about Police Shootings in America." Based on the article, respond to the following questions in three paragraphs: Summarize the article in one brief paragraph....
-
a bank has a commercial loan portfolio of $ 5 0 million dollars. based on historic trend analysis it estimates that 5 0 % of outstanding principal is not paid back. the bank determines 7 % is the...
-
Here are the actual results of the experiment. Which of the four treatments are controls? Explain your answer. Which of the results is unexpected? What are two hypotheses that might explain the...
-
Octavio, age 42, had the following items of income: Earnings as a general partner in a partnership of $400. Workers compensation of $600. Gambling losses of $200. Distribution from profit sharing...
-
Joseph planted corn on land that he owned and later deeded the land to Helen without reserving the corn crop. When Helen sold the crop, Joseph sued her for the price she received. Who wins? Why?
-
16. a) The graphs show the effect of raw sewage effluent on a river. (ii) (iii) Describe the effect of discharging raw sewage into the river at point 'A' on. Bacteria (4mks) Oxygen. Algae b) Explain...
-
The graph of an equation is given. (a) Find the intercepts. (b) Indicate whether the graph is symmetric with respect to the x-axis, the y-axis, or the origin. -3 6 -6 3 x
-
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 +...
-
For the data set a. Find the first and third quartiles. b. Find the IQR. c. Find the upper and lower outlier boundaries. d. List all the values, if any, that are classified as outliers. 15 7 2 4 4 3...
-
A population has mean = 25 and standard deviation = 4. a. Find the z-score for a population value of 16. b. Find the z-score for a population value of 31. c. What number has a z-score of 2.5?
-
For the data set 37 82 20 25 31 10 41 44 4 36 68 a. Find the first and third quartiles. b. Find the IQR. c. Find the upper and lower outlier boundaries. d. List all the values, if any, that are...
Study smarter with the SolutionInn App