Knowee
Questions
Features
Study Tools

Choose different step sizes h and plot a log-log graph of error vs step size to compare the numerical derivatives found using the forward, backward, and central difference formulas with the actual derivative. How accurate are the numerical derivatives at x = 0, 1, 1.5, and 2? At what step sizes do you obtain the minimum errors, and what are the minimum errors (see Sauer figure 5.1)? when x=? can get the minimum errors

Question

Choose different step sizes h and plot a log-log graph of error vs step size to compare the numerical derivatives found using the forward, backward, and central difference formulas with the actual derivative. How accurate are the numerical derivatives at x = 0, 1, 1.5, and 2? At what step sizes do you obtain the minimum errors, and what are the minimum errors (see Sauer figure 5.1)? when x=? can get the minimum errors

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

As an AI, I'm unable to directly plot graphs or perform computations. However, I can guide you on how to do it.

  1. Choose a function for which you know the derivative. For example, let's take f(x) = sin(x). The derivative of this function is f'(x) = cos(x).

  2. Choose different step sizes h. For example, you can choose h = 1, 0.1, 0.01, 0.001, etc.

  3. Calculate the numerical derivatives at x = 0, 1, 1.5, and 2 using the forward, backward, and central difference formulas.

    Forward difference formula: f'(x) ≈ (f(x+h) - f(x)) / h Backward difference formula: f'(x) ≈ (f(x) - f(x-h)) / h Central difference formula: f'(x) ≈ (f(x+h) - f(x-h)) / (2h)

  4. Calculate the actual derivative at x = 0, 1, 1.5, and 2 using the derivative function f'(x) = cos(x).

  5. Calculate the error at each x for each step size h and for each numerical derivative. The error is the absolute difference between the numerical derivative and the actual derivative.

  6. Plot a log-log graph of error vs step size for each numerical derivative. You should have three graphs, one for each numerical derivative.

  7. From the graphs, you can see at what step sizes you obtain the minimum errors and what the minimum errors are.

  8. To find out at which x you can get the minimum errors, you would need to repeat the above steps for different x values and compare the results.

Remember, the accuracy of the numerical derivatives depends on the step size h. The smaller the step size, the more accurate the numerical derivative. However, if the step size is too small, you may encounter round-off errors.

This problem has been solved

Similar Questions

use matlab to do: Calculate the 2nd derivative and higher derivatives of f (x) = 1 + x + x^2 +x^3 + x^4 + x^5 + x^6 + x^7 + x^8 using the finite difference formulae for higher derivatives, and use loglog to plot the chart. and use words tell me that how do the errors vary with step size?

use matlab to do: Calculate the 2nd derivative and higher derivatives of f (x) = 1 + x + x^2 +x^3 + x^4 + x^5 + x^6 + x^7 + x^8 using the finite difference formulae for higher derivatives. How do the errors vary with step size?

use matlab to explain Estimate the error in a numerical derivative and/or integral from the convergence of the solution as the step size is changed. (It’s best to use step sizes that are large enough to avoid round-off error.) Compare your estimate of the error with actual error determined from comparison with the analytical solution, if an analytical solution is available.

Add some additional error to your polynomial. For example, try y =f(x) + 0.001 * randn(size(x));. How does the error in the numer- ical derivative vary with step size h?

Integration over an infinite interval. Integrate exp(−x) from x = 0 to x = ∞, by numerically integrating from x = 0 to increasing values of x. Plot a graph of the error vs the value of x you integrate to. Compare results for a fixed step size and a fixed number of steps. use matlab to finish show me the codes

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.